language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> #include<math.h> void main() { int gd=DETECT,gm; double x1,y1,xr,yr,r,x2,y2,x3,y3; clrscr(); printf("enter the co-ordinates of point A of triangle"); scanf("%lf %lf",&x1,&y1); printf("enter the co-ordinates of point B of ...
C
#include <stdio.h> int main() { int h, w, n, bricks[10000]; scanf("%d%d%d", &h, &w, &n); for (int i = 0; i < n; i++) { scanf("%d", &bricks[i]); } int b = 0, completed = 1; for (int i = 0; i < h; i++) { int sum = 0; while (sum < w) { if (b >= n) { ...
C
/** * compile with the following command * gcc -Wall -g getUser.c -o getUser `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ #include <gtk/gtk.h> GtkWidget** allSongs; char **allMp3, **allArtists; char user2[50]; int addSongs(GtkWidget *box) { FILE* fp = fopen("musicaCliente.txt", "r"); c...
C
/* You are given two matrices and you have to output a new matrix which is their sum. The sum of matrices is calculated by adding each of the members from the first matrix with each of the members of the second one and producing a number which is a member of a new matrix and is stationed in the same row and c...
C
#include "dispatcher.h" /* rimuove tutti i reader lenti (quelli che avevano il buffer pieno) dalla lista. * Il reader riceve una poison_pill e si distruggera' da solo. * tentera' anche di rimuoversi dalla lista, nonostante in questo caso gia' non ci sia (non crea problemi). */ void remove_slow_readers(list_t *list...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char *file2strl(const char *path, unsigned int *file_len_out) { FILE *file; int e; file = fopen(path, "rb"); if (!file) { fprintf(stderr, "Unable to open file %s\n", path); return NULL; } e = fseek(file, 0, SEEK_E...
C
#include <stdio.h> int _strncmp(char *, char *, int); int main() { char s1[] = "Hello"; char s2[] = "Hello"; printf("String 1: %s\nString 2: %s\n%s\n", s1, s2, _strncmp(s1, s2, 3) == 0 ? "Strings are equal" : _strncmp(s1, s2, 3) > 0 ? "String 1 is bigger than string 2" : "String 1 is less than stri...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* btok_get.c :+: :+: :+: ...
C
//Write a program to find the kth minimum and maximum element in Heap. #include <stdio.h> #include <stdlib.h> #include <time.h> void swap(int *a, int *b){ int temp = *a; *a = *b; *b = temp; } void maxHeapify(int arr[], int n, int pos){ if(pos >= (n/2)){ return; } int l = pos*2 + 1; int r = pos*2 + 2; int l...
C
/* * lispy.h * Copyright (C) 2016 sabertazimi <sabertazimi@gmail.com> * * Distributed under terms of the MIT license. */ #ifndef LISPY_H #define LISPY_H #include "mpc.h" #define LASSERT(args, cond, fmt, ...) \ do { \ if (!(cond)) { ...
C
//Ques: To create named pipes; #include<stdio.h> #include<unistd.h> int main(){ mkfifo("fifo",0777); printf("Named pipe createad:)"); } //Type " ls -l " in terminal to see the output of the file // The file will be named as fifo and alongside its permissions in the extreme left, a " p " will be written indicating that...
C
#include <stdio.h> // Your program must first read an integer indicating the number of grades to be averaged. // Next, your program will read the grades one by one, all of which are integers as well. // Finally, your program will calculate and print the average of the grades to two decimal places. int main(void) { ...
C
/****************************************************************************** * Header file inclusions. ******************************************************************************/ #include "FreeRTOSConfig.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "semphr.h" #include <avr/io.h> ...
C
#include<stdio.h> int main(){ int fn1 = 1; int fn2 = 1; int f = 0; int n; int i; printf("input n to calaulate f(n)=f(n-1)+f(n-2),f(0)=1,f(1)=1:\n"); scanf("%d",&n); if(n >= 2){ for(i = 2;i <= n;i = i + 1){ f = fn1 + fn2; fn2 = fn1; fn1 = f; } printf("f(n)=%d",f); } else if(n == 1 ) p...
C
#include "main.h" //compile & start with: // gcc -o balls defines.h main.h main.c -lncurses -lpthread && ./balls int main(int argc, char *argv[]) { setup_and_start(); } void setup_and_start() { //for randomness srand(time(NULL)); //isEnd & frame isEnd = false; pthread_mutex_init( &isEndMutex...
C
#include "algorithms.h" int main() { FILE *fin; fin = fopen("input.dat", "r"); int noOfVertices; int **adjMatrix = inputAdjMatrix(fin, &noOfVertices); List *adjList = getListFromMatrix(adjMatrix, noOfVertices); printf("\n\nThe adjacency list from given adjacency matrix:\n"); printAdjList(...
C
#include "time.h" #include <stdio.h> #include <avr/io.h> #include <util/delay.h> int main() { /* set PORTB for output*/ DDRB = 0xFF; /* set PORTD for input*/ DDRD &= ~_BV(PORTD2); PORTD |= _BV(PORTD2); int dance = 0; while (1) { _delay_ms(100); if (PIND & _BV(PORTD2)) { dance = ~dance; } if (d...
C
#include <stdlib.h> #include <stdio.h> #include "scene.h" Scene* new_scene(void) { Scene* s = (Scene *)malloc(sizeof(Scene)); s->element_count = 0; s->sprite_count = 0; s->first = (void*)0; s->last = (void*)0; return s; } void free_scene(Scene* s) { Element* current; Element* n...
C
/* ** function.c for in /home/simomb_s/semestre4/rendu_4/PSU_2015_malloc/tmp1 ** ** Made by stephanedarcy simomba ** Login <simomb_s@epitech.net> ** ** Started on Tue Feb 2 08:08:25 2016 stephanedarcy simomba ** Last update Wed Feb 10 21:08:02 2016 stephanedarcy simomba */ #include <unistd.h> #include <stdlib.h> ...
C
#include <pthread.h> #include <semaphore.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <errno.h> #define DEBUG_INFO(fmt, args...) printf("\033[33m[%s:%s:%d]\033[0m "#fmt"\r\n", __FILE__,__FUNCTION__, __LINE__, ##args) /* 线程A获得信号量成功后,B线程sem_waitdwait获取信号量,阻塞一定的时间再返回,注意第二个参数是时间戳 */ sem_t sem; v...
C
int silnia(int x) { if(x == 0) return 1; else return x * silnia(x - 1); }
C
#include "holberton.h" /** * rot13 - encodes a string using rot13. * @s: number of elements * Return: Always 0. */ char *rot13(char *s) { int i, j; char array1[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char array2[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; for (i = 0; s[i] != '\0...
C
#include <stdio.h> #include "libs/libs.h" static const char *outputFileName = "result.bin"; int main(int argc, const char *argv[]) { /* Initializing variables */ auto FILE *fin, *fout; /* Files */ /* Place to hold one KVP */ auto STL_String tok; STL_String_init(&tok); auto char *keyValue; ...
C
//MERGESORT #include <stdio.h> #include <stdlib.h> #include <string.h> int a[20],b[20]; void merge(int low,int mid,int high) { int l1,l2,i; for(l1=low,l2=mid+1,i=low;l1<=mid && l2<=high;i++) { if(a[l1]<=a[l2]) b[i]=a[l1++]; else b[i]=a[l2++]; } while(l1<=mi...
C
#include <stdio.h> #include "holberton.h" int returnnumber(char *numpassed); //int _strlen(char *s); int main(void) { int nildiert; char *charnum = "sdfs 0"; returnnumber(charnum); nildiert = returnnumber(charnum); printf("Esta es mi variable %d \n", nildiert); return (0); } int returnnumber(char *numpassed) {...
C
/* File name: buffer.h * Author: Lucas Estienne * Purpose: This contains macro definitions, as well as declarations and prototypes necessary for * the Buffer component of the Compiler. */ #ifndef BUFFER_H_ # define BUFFER_H_ /*#pragma warning(1:4001) *//*to enforce C89 type comments - to make //comments an wa...
C
#include<stdio.h> void main(){ char to_upper(char); char to_lower(char); char is_lower(char); char is_upper(char); char is_digit(char); char is_alphabet(char); char ch,i; int choice; do { printf("enter the value "); scanf("%c",&ch); printf("ENTER YOUR CHOICE\n"); printf("1. convert to upper ca...
C
#include<GL/glut.h> #include<math.h> void init() { glOrtho(-10,10,-10,10,-10,10); } void display() { glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,0.0,0.0); glPointSize(5); glBegin(GL_LINE_STRIP); for(double d=-10;d<10;d=d+0.01) { glVertex2f(d, sin(d)/d); } glEnd(...
C
#include "object.h" #ifndef CHARACTER_H #define CHARACTER_H /** * @class character * @brief an abstract class for all characters in a role playing game * @inherits object */ typedef struct CHARACTER_CLASS{ /** * @brief constructs a new character and return it * @return a new character object * @details...
C
#include <stdio.h> #include <wchar.h> #include <locale.h> int main(){ setlocale(LC_CTYPE, ""); wprintf(L"Поместите требуемый для обработки текст в файл input.txt\n"); wprintf(L"Если текст введен в требуемый файл, для продолжения нажмите введите \"y\" \n"); wprintf(L"Если хотите выйти из программы, наж...
C
// Print numbers from 1 to 5 #include <stdio.h> int main() { int i = 1; while (i <= 100) { if(i%2==0){ printf("%d\n", i); } ++i; } return 0; }
C
// Herman Zvonimir Došilović /* Za učitani N, ispiši zadnju znamenku broja N! koja je > 0. */ #include <stdio.h> int main(void) { int T; scanf("%d", &T); while (T--) { int N; scanf("%d", &N); int sol = 1, n5 = 0; for (int i = 2; i <= N; i++) { if (i%5 == 0) { int k = i; whi...
C
/* Autores: Brandon Ledezma Fernández Walter Morales Vásquez Código con la capacidad de crear y manejar hilos implementados en el espacio de usuario de la misma manera en que funcionan en la biblioteca de POSIX pthread. Además, permite especificar los tiempos de vida un hilo en particular al momento de la creación de ...
C
#include "stdio.h" #include "stdlib.h" #include "math.h" u_int32_t RET[100]={}; int IRET=0; u_int32_t mypow(int n) { if (n==0) { return 0; } return pow(n, n); } void evaluate(int in[10]) { int i, freq[10]={}; u_int32_t n=0; char buf[11]; for (i=0;i<10;i++){ freq[in[i]] ++; n+=mypow(in[i]);...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <math.h> #include <assert.h> #include <string.h> #include <time.h> #define MAX_LAYERS 10 #define NDEBUG char asciimap[] = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'."; // TODO: wrap static variables in a "state", struct s...
C
#include "state_stack.h" #include "../../lib/tbox/tbox.h" StateStack* StateStackInit() { StateStack* stack = (StateStack*)tb_malloc(sizeof(StateStack)); if (stack == NULL) { return NULL; } stack->length = 0; stack->top = NULL; return stack; } void StateStackDestroy(StateStack* stack) {...
C
/* this is the sample program in C- in the book "Compiler Construction" */ /* A program to perform selection sort on a 10 element array. */ int x[10]; int minloc ( int a[], int low, int high ) { int i; int x; int k; k = low; x = a[low]; i = low + 1; while (i < high) { if (a[i] < x) { x = a[i]; ...
C
#include <stdio.h> #include <stdlib.h> int main(void) { char c; FILE *fp; fp = fopen("/Users/mikeluz/Documents/C/texteditor.txt", "a"); while ((c = getchar()) != EOF) { fprintf(fp, "%c", c); } fclose(fp); }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <time.h> #include <dirent.h> #include <sys/stat.h> #include <sys/types.h> #include <signal.h> int childHandler(int i){ return i; } void main(int argc, char const *argv[]) { struct stat statbuf; int directorios[10] = {1,2,3,...
C
#include <assert.h> #include <aterm2.h> /* This example demonstrates the use of an ATermPlaceholder. It creates * the function application "add" defined on two integers without actually * using a specific integer: add(<int>,<int>). */ void demo_placeholder() { Symbol sym_int, sym_add; ATermAppl ...
C
#include<stdio.h> #include<math.h> #include"spectrum.h" double pix_to_wave(double crval, double cdelt, double crpix, double pix, bool loglin){ if(loglin){ return pow(10.,(crval+cdelt*(pix-crpix))); }else{ return crval+cdelt*(pix-crpix); } } int get_wave_index(const double wave_arr[], size_...
C
//ʵж //#define _CRT_SECURE_NO_WARNINGS //#include <stdio.h> //int is_leap_year(int year) //{ // if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) // { // return 1; // } // else // return 0; //} //int main() //{ // int year = 0; // printf("ݣ"); // scanf("%d", &year); // if (is_leap_year(year) == 1) // printf...
C
#include<stdio.h> void main (void) { float Navio[64]; float Peso,PesoSetor1=0,PesoSetor2=0,PesoSetor3=0,PesoSetor4=0; int NumContainer=0,NumSetor1=0,NumSetor2=0,NumSetor3=0,NumSetor4=0; int i; for (i = 0;i<63;i++) Navio[i]=0; do { printf("Digite o Peso do container ou -1 pa...
C
#include <stdlib.h> #include <unistd.h> #include <err.h> #include <sys/types.h> #include <fcntl.h> #include <sys/wait.h> #include <stdbool.h> #include <string.h> #include <time.h> #include <stdio.h> int main(int argc, char** argv){ char* duration = argv[1]; if(duration[1] != '\0'){ err(1, "Input an integer between 0-...
C
/* ** EPITECH PROJECT, 2018 ** get_next_line1.c ** File description: ** gnl */ #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include "get_next_line.h" static int my_strlen(char const *str, int pos) { int count = pos; while (str != NULL && (str[count] != '\n' && str[count] != '\0')) count++; return...
C
/* ========================================================================== */ /* */ /* sbi.c */ /* (c) 2012 Gi@cky98 ...
C
/****************************************************/ /* File: analyze.c */ /* Semantic analyzer implementation */ /* for the TINY compiler */ /* Compiler Construction: Principles and Practice */ /* Kenneth C. Louden ...
C
#include "mtree.h" #include "queue.h" #include <math.h> #include <stdio.h> #include <stdlib.h> #define WIDTH 80 MTree *mtree_create(int m) { MTree *mtree = malloc(sizeof(MTree)); mtree->m = m; mtree->n = 0; mtree->root = mtree->free_node = NULL; return mtree; } void mtree_destr...
C
//Problem: float a = 3/4; //-> 0.000 //Solutions: float b = 3.0/4; //-> 0.750 float c = 3/4.0; //-> 0.750 float d = (float)3/4; //-> 0.0750 float e = 3/(float)4; //-> 0.0750
C
#include<stdio.h> typedef struct listnode *listpointer; typedef struct listnode { int data; listpointer link; } listnode; listpointer list[100],temp,ptr; main() { int n,i,j,k; int G[100][100],count[100],mark[100]; freopen("in.txt","r",stdin); scanf("%d",&n); for(i=0; i<n; i++) { ...
C
/* ============================================================================ Name : tp4ex5.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h> ...
C
#include <stdio.h> int main(void) { int date = 20180314; char c1 = 'w', c2 = 'h', c3 = 'i', c4 = 't', c5 = 'e', c6 = 'd', c7 = 'a', c8 = 'y'; printf("정수형 오늘 날짜: %d\n", date); printf("문자형: %c%c%c%c%c%c%c%c\n", c1, c2, c3, c4, c5, c6, c7, c8); return 0; }
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #define MEMO_LIST_SIZE 32 struct message { char title[50]; char body[255]; }; static struct message messages[MEMO_LIST_SIZE]; static char message_list_bitmap[MEMO_LIST_SIZE]; void vuln() { asm("pop %rdi; pop %rsi; pop %rdx; ret"); } ...
C
#ifndef PROTOCOL_INTERFACE_H #define PROTOCOL_INTERFACE_H #include <stdio.h> #include <stdlib.h> #include <string.h> enum protocol{ WIRED, WIRELESS, IP, ARP, ICMP }; typedef struct protocol_util * protocol_ptr; struct protocol_util{ enum protocol type; void * protocol_format; void (*print)(protocol_ptr, char...
C
/** * ULIPE RTOS PICO * * @file k_sema.h * * @brief basic semaphore usage header file * */ #ifndef __K_SEMA_H #define __K_SEMA_H #if K_ENABLE_SEMAPHORE > 0 /* semaphore control block structure */ typedef struct ksema{ archtype_t cnt; archtype_t limit; bool prio_ceilling; bool created; uint8_t pri...
C
/* ------------------------------------- File: myrecord.c Project: cp264_a4_koha5160 ------------------------------------- Author: Nausher Rao ID: 190906250 Email: raox6250@mylaurier.ca Version 2021-02-12 ------------------------------------- */ #include <stdio.h> #include <string.h> #include <st...
C
/* file: c_stepper.c purpose: create python library implements: a time step for the explicit FTCS scheme to solve the time-dependent heat equation author: Mihai Duta, Advanced Research Computing, University of Oxford */ # include <math.h> void timestep ( ...
C
#ifndef struct_h #define struct_h #include <stdlib.h> #include <stdio.h> #include<math.h> #include <assert.h> #include <stdbool.h> #include <time.h> //******************************************************************************************************** // simple type to mark the assignment of literals typedef char...
C
/* ============================================================================ Class : CISC 192 - C/C++ Assignment : PSA8 Student : David Date submitted : 3/15/2017 Description : In this PSA you will build a command line calculator. This is just a simple four function calculator. However, there a...
C
/* * open_close.c * * Created on: May 4, 2017 * Author: zhaocc */ #include<stdio.h> #include<stdlib.h> #include<fcntl.h> int main(void) { FILE *fp, *fp1; int fd; if ((fp = fopen( "/home/zhaocc/sourceCode/linux c/fileTest/StreamTest/hello.txt", "a+")) == NULL) { printf("fopen failed"); exit(1); ...
C
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include "battleship.h" #include <time.h> int main(int argc, char **argv){ menuScreen(); srand(time(0)); int size = 8, maxshots, err; err = parseArgs(argc, argv, &size, &maxshots); //check for valid input and print message if th...
C
/************************************************************************************** : Weather : WeatherInformerContainer.h : WeatherInformerContainer, 5- . **************************************************************************************/ #ifndef WEATHER_INFOR...
C
#include <stdio.h> #include "dk_tool.h" int main() { IntTree *theTree = createIntTree(); insertIntValueToTree(theTree,40); insertIntValueToTree(theTree,23); insertIntValueToTree(theTree,44); insertIntValueToTree(theTree,112); insertIntValueToTree(theTree,3); insertIntValueToTree(t...
C
/* https://www.codechef.com/SEPT17/problems/CHEFSUM https://www.codechef.com/viewsolution/15209584 */ #include<stdio.h> int main() { int t,n,a[100000],i,min,r; scanf("%d",&t); while(t--) { min=2147483647; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); if(min>a[i]) { min=a[i]; ...
C
#include<stdio.h> #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<string.h> int main() { int fd = open("./log", O_CREAT | O_RDWR); if(fd < 0) { perror("open"); exit(1); } int new_fd = dup2(fd, 1); if(new_fd < 0) { perror("dup2"); exit(2); } close(fd); int co...
C
/************************************************************************************************** * INCLUDES * **************************************************************************************************/ #include <errno.h>...
C
#include <PNMreader.h> #include <PNMwriter.h> #include <filter.h> #include <logging.h> #include <iostream> #include <fstream> #include <stdlib.h> using std::cerr; using std::endl; using std::ofstream; int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <username>" << e...
C
#include <stdio.h> #define FALSE 1 #define TRUE 0 main() { int c; int word = 0; int inword = FALSE; while ( (c = getchar()) != EOF) { if ( (c != ' ' && c != '\t' && c != '\n') && inword == FALSE) { word++; inword = TRUE; } if (c == ' ' || c == '\t' || c == '\n') { inword = FALSE; } } printf(...
C
#ifndef __PRIVATE_KNR_MALLOC_H__ #define __PRIVATE_KNR_MALLOC_H__ /*! @typedef Align */ typedef long Align; /* for alignment to long boundary */ /*! @union header @field s @field x */ union header { /* block header */ /*! @struct @field ptr @field size */ struct {...
C
#include <msp430.h> #include <stdio.h> #include "led.h" void timer_init() { // Reset timer TA0CTL = TACLR; // Select ACLK, TimerA counter divisor in 1, halted, TA0CTL = TASSEL__ACLK | ID__1; // Compare mode TA0CCTL0 &= ~CAP; // Enables the CCR0 interrupt TA0CCTL0 |= CCIE; } void timer_start() { //Since the...
C
/*Larry W. Cashdollar Just some code to run when testing RCI. It writes parent process PID, Name and stats from /proc/PID/status to a /tmp file. 8/4/2013 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXBUF 128 #define LILBUF 32 int main (void) { FILE *fout; char tmp[LILBUF], buffer[MAX...
C
/* Author - @Faiz Khan Output------------- Enter the no. of terms: 4 5 5 4 5 4 3 5 4 3 2 */ #include<stdio.h> void main() { int n; printf("Enter the no. of terms"); scanf("%d",&n); for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) ...
C
/***************************************************************************** NAME: ias_math_compute_stdev PURPOSE: Calculates the sample standard deviation. RETURN VALUE: Type = int Value Description ----- ----------- SUCCESS Standard deviation was calculated. ERROR Sample size was zero. ****************...
C
#include<stdio.h> #include<string.h> int main() { int N, i, total=0; char input[101] = ""; scanf("%d", &N); scanf("%s", input); for (i = 0; i < N; i++) { total += (input[i] - '0'); } printf("%d\n", total); return 0; }
C
/* ============================================================================ Name : 171.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h> #inc...
C
/* * vector_insert.h * * Created on: 8.2.2010 * Author: Lukáš Křivský */ #ifndef VECTOR_INSERT_H_ #define VECTOR_INSERT_H_ #include "vector_struct.h" //! Insert scalar into specified vector element /*! * From parameter element there will be used only the least significant bit to chose vector element. *...
C
#include<stdio.h> int map[1030][1030]; int dp[1030][1030]; int main() { int n, m; scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) scanf("%d", &map[i][j]); } for (int i = 1; i <= n; i++) { dp[i][1] = map[i][1]; for (int j = 2; j <= n; j++) { dp[i][j] = dp[i][j - 1...
C
// Include file BMP3.H (used in MAIN5.C and MAIN6.C) // Written by Daniel W. Lewis // Revised Jan 2, 2015 // // Purpose: Manipulation of 24-bit RGB BMP files using // direct access to the internal data structures. #include <stdint.h> typedef struct { uint8_t blu ; // 0 to 255 uint8_t grn ; // 0 to 2...
C
//3.Accept 5 numbers and give their avarage: #include<stdio.h> int main() { int a,b,c,d,e; float avg; printf("Enter five numbers:"); scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); avg=(a+b+c+d+e)/5.0; printf("\nThe average of five numbers:",avg); return 0; }
C
#include <stdio.h> #include <stdlib.h> double conversion(double grauF){ double grauC; grauC = 5 * (grauF - 32) / 9; return grauC; } int main(){ int cases, i; scanf("%d", &cases); double fahrenheit[cases], celsius[cases]; for(i = 0; i < cases; i++){ scanf("%lf", &fahrenheit[i]);...
C
#include "header.h" /* Rezeq Abu Madeghem 211606801 Omar Hmdea 206635922 */ int Last_used=0; int main(int argc,char* argv[]) { char input_file[MAX_LEN],output_file[MAX_LEN]; Page **main , **sec; int m,n,useLru; useLru=atoi(argv[1]); m=atoi(argv[4]); n=atoi(argv[5]); strcpy(input_file,argv[2]); strcpy(output_file,a...
C
//Anupreet Singh roll no.11911063 #include<stdio.h> #include<stdlib.h> //Structure of tree node struct node{ int data; struct node *left; struct node *right; }; //returns a new node struct node *createNode(int data){ struct node *newNode = (struct node*)malloc(sizeof(struct node)); newNode->data =...
C
/*KUNAL ARORA 737/IT/12 PROGRAM-->substring search using naive substring search algorithm */ #include<stdio.h> #include<string.h> int strncmp2(char*,int,char*); int main() { char str[50],sub[50]; int found=0,i,j,k; printf("\n*********SUBSTRING SEARCH***********\n"); printf("\nKUNAL ARORA\n"); prin...
C
#include<stdio.h> #include<stdbool.h> #include<stdlib.h> //임의의 정수n을 입력받아 제곱근을 구하고 제곱근이 있다면 n+1의 제곱을 반환, 없으면 -1을 반환 void main(void){ long long answer = -1; long long n; scanf("lld", &n); printf("n: %lld\n",n); for (long long i =1; i <= n; i++) if (n / i == i && n % i == 0){ answer = (i + 1) * (i + 1); br...
C
/* * sensors-spi.c * * Created: 2017-07-31 * Author : Craig Hollinger * * This is an example program that uses the I2C bus to read data from sensors * and display it on an SPI OLED display. The sensors are an accelerometer, * a gyroscope and a magnetometer. Each sensor has three axes of data and * communica...
C
/* * PRACTICA 4 - EJERCICIO 4 * Realiza un programa que escriba por pantalla el máximo de los elementos de un vector. * Para ello se deben usar las funciones cuyos prototipos se describen a continuación y utilizar * aritmética de punteros para acceder a los elementos del vector. * * void leer_vector(int *vect...
C
#include<stdio.h> int main() { int Arr[51]={0}; int Cnt=5; for(int i=1;i<7;i++) { printf("%d\n",Cnt/2); Cnt=Cnt*3; } return(0); }
C
/* The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can be seen that this sequence (starting at 13 and finishing at 1) con...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #ifdef __APPLE__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #define RAD2DEG(X) ((X * 180.0)/M_PI) //#define DFILE "A2.ply" #define CHUNK 4 #define MAX 2048 typedef struct thing { double x, y, z; // position doub...
C
#include <stdio.h> int main() { char str[1000], max, str1[1000], str2[] = {"(max)"}; gets(str); int i, k = 0; max = str[0]; for (i = 0; str[i] != '\0'; i++) { if (str[i] > max) { max = str[i]; } } for (i = 0; str[i] != '\0'; i++) { str1[k]...
C
// // Simple off-by-one bug. // #include <stdio.h> #include <klee/klee.h> //---------------------------------------------------------------------- void StringCopy(char *dst, const char *src) { while (*src != '\0') { *dst++ = *src++; } *dst++ = '\0'; } //----------------------------------------------------...
C
#ifndef _PRINTF #define _PRINTF #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdarg.h> int _printf(const char *format, ...); int _putchar(char c); /** *struct specify - Struct for select specify of function printf. *@type: Check types of specify. *@ftype: Call function print types. *D...
C
/* ** my.h for my.h in /home/lblanchard/CPool_Day09/include ** ** Made by Leandre Blanchard ** Login <lblanchard@epitech.net> ** ** Started on Thu Oct 13 09:19:01 2016 Leandre Blanchard ** Last update Sat Dec 30 00:39:02 2017 Léandre Blanchard */ #ifndef MY_H_ # define MY_H_ # ifdef __cplusplus extern "C" { #end...
C
/* *** curdown.c *** */ /* */ /* IBM - PC microsoft "C" */ /* */ /* Function to move the curs...
C
#include <stdio.h> #include <stdlib.h> #include<math.h> int main() { int num,i,j,arr[1000]; long answer=1; printf("Enter a number\n"); scanf("%d",&num); for(i=0;i<num;i++) { scanf("%d",&arr[i]); } for(j=0;j<num;j++) { answer=(answer*arr[j])%(int)((pow(10,9)...
C
//IMplements a doubly linked list and prints it :-) #include <stdio.h> struct entry { int value; struct entry *next; struct entry *prev; }; /* //Function to insert an entry into a linked list after an entry void insertEntry(struct entry *insert, struct entry *list_spot) { //New struct points to list_spot's next ...
C
// Вариант 1 #include <stdlib.h> #include <string.h> #include <stdio.h> #include <errno.h> #include <locale.h> typedef int bool; #define true 1 #define false 0 struct boot_block { unsigned char bootstrap[3]; unsigned char manufacturer[8]; unsigned short n_bytes_per_block; unsigned char n_blocks_per_a...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main (int argc, char**argv)//usamos variables { int i; //declaramos variables int a=atoi(argv[1]); int b=atoi(argv[2]); int c=atoi(argv[3]); int aux; aux=a; for(i=0;i<3;i++)//usamos el ciclo for { if(a>b) { ...
C
/* Downturn game implementation in C * Basically Connect 4 but with board rotations and gravity * Chanik Bryan Lee */ #include "pos.h" #include <stdlib.h> #include <stdio.h> pos make_pos(unsigned int r, unsigned int c) { pos make; /* pos make = {r, c}; */ make.r = r; make.c = c; return m...
C
#include "test/test-secretary-gtk/date-cell-renderer.h" #include "secretary-gtk/date-cell-renderer.h" #include "secretary-gtk/_internal/date-cell-renderer.h" #include "secretary-gtk/gettext.h" #include "time.h" static void test_sct_gtk_date_cell_renderer_set_date_thru_calendar_sets_entry( CuTest *test) { ...