language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> void main() { int n,i,a,c=0;float s=0; printf("enter n"); scanf("%d",&n); printf("enter numbers"); for(i=1;i<=n;i++) { scanf("%d",&a); if(a%2==0) { s=s+(a*i); c=c+i; } } s=s/c; printf("the average weighted sum of even numbers=%.2f",s); }
C
/* Fill in your Name and GNumber in the following two comment fields * Name: Rushil Nandan Dubey * GNumber: G01203932 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "clock.h" #include "structs.h" #include "constants.h" /* Schedule Count * - Return the number of Processes in the list. */...
C
#include "generic-list.h" #include <assert.h> #include <stdio.h> typedef struct integ_list { int size; int *values; node_t node; } integ_list_t; integ_list_t* integ_list_init() { integ_list_t *list = calloc(10, sizeof(integ_list_t)); if (!list) return NULL; list->values = calloc(2, ...
C
#include "pila_estatica.h" //Cmo saber calcular el espacio de mi pila y cunto llenarla. En este caso dijimos que es de 200 bytes en el define. //TAM_PILA 200 //como nosotros declaramos que lo usaremos con una pila de enteros, esto indica que cada numero ocupa 4 bytes, //pero ademas necesito otros 4 bytes para indicar ...
C
#include <string.h> #include <stdio.h> #include "InputGenerator.h" #include "ProfileTimer.h" #if defined(WINDOWS_BUILD) #include <stdlib.h> #define MSBF16(x) (_byteswap_ushort(*((unsigned short const*)x))) #define MSBF32(x) (_byteswap_ulong(*((unsigned long const*)x))) #endif #ifndef WINDOWS_BUILD #if BY...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define MAX_NUM 100 #define MAX_ATTEMPTS 5 #define TRUE 1 #define FALSE 0 int getSecretNumber(int); int getGuess(int); int checkGuess(int, int); int main(void) { int secretNum; int guess; int attemptsRemaining = MAX_ATTEMPTS; int gotIt = F...
C
// These two includes are here because streaming output was coded for the M2 (http://medesign.seas.upenn.edu/index.php/Guides/MaEvArM) // For other systems, replace strcpy_P and m_usb_tx_char with strcpy and printf, or whatever is appropriate. #include "m_general.h" #include "m_usb.h" #include "base64.h" const char b...
C
struct Point { int x; int y; }; Point *Point__init(Point *self, int x, int y) { self->x = x; self->y = y; } Point *Point__create(int x, int y) { Point *result = (*Point) malloc(sizeof(Point)); Point__init(result, x, y); return result; } void Point__reset(Point *self) {} void Point__destroy(Point *point) { ...
C
#include <stdio.h> int main(int argc, char *argv[]) { int ages[] = {23, 43, 12, 89, 2}; char *name[] = { "Alan", "Frank", "Mary", "John", "Lisa" }; int count = sizeof(ages) / sizeof(int); int i = 0; for(i = count-1; i >= 0; i--) { printf("%s has age %d \n", name[i], ages[i]); } printf("-----\n"); ...
C
../caseG/g.c
C
/* * os.c * * Created on: Feb 12, 2020 * Author: Tim Buckley */ #include "osDef.h" void TIM2_IRQ_Handler2(void) { HAL_TIM_IRQHandler(OS_Timer); } void OS_Init(TIM_HandleTypeDef* thisTimer) { __disable_irq(); OS_Timer = thisTimer; OS_ThreadCreate("IDLE", OS_Idle, OS_PRIORITY_NONE, OS_IdleStack, OS_MIN_S...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ast_build.c :+: :+: :+: */ /* ...
C
#include <stdio.h> #pragma warning(disable : 4996) #include <limits.h> #include <math.h> #define MONTHS 12 #define SECOND_PER_MINUTE 60 /* int main(void) { printf("Hello World"); int x; x = 5; printf("%d", x); printf(" x ޸ ũ %dԴϴ.", sizeof(x)); int x = 50; float y = 123456789.123456789; do...
C
/* Name: Joan Andoni González Rioz Definition of an image data structure for PGM format images Uses typedef, struct Uses functions to read and write a file in PGM format, described here: http://netpbm.sourceforge.net/doc/pgm.html http://rosettacode.org/wiki/Bitmap/Write_a_PGM_file#C Gilberto E...
C
#include "uart.h" // ڳʼ void uart_init(void) { // ʼTx RxӦGPIO rGPA0CON &= ~(0xff<<0); // ѼĴbit07ȫ rGPA0CON |= 0x00000022; // 0b0010, Rx Tx // ؼĴ rULCON0 = 0x3; rUCON0 = 0x5; rUMCON0 = 0; rUFCON0 = 0; // DIV_VAL = (PCLK / (bps x 16))-1 // PCLK_PSYS66MHz 0.8 //rUBRDIV0 = 34; //rUDI...
C
#include <stdio.h> #include <stdlib.h> #include "system_m.h" #include "interrupt.h" #include "kernel2.h" /************* Symbolic constants and macros ************/ #define MAX_PROC 10 #define MAX_MONITORS 10 #define DPRINTA(text, ...) printf("[%d] " text "\n", head(&readyList), __VA_ARGS__) #define DPRINT(text) DPRIN...
C
/********************************************************* * MATRIX ADD * * Author: Reez Patel * * Source: Ex: 11.4 (P-394) = ANSI-C * **********************************************************/ #include <stdio.h> #define LIMIT 3 void inputMat(int a[][3]); void addMat(int a[][3],int b[][3],int c[][3]); voi...
C
#include <stdio.h> int main(void) { printf("The controller char test\n"); int in,i; printf("Input choice\n"); printf("\r 1.\\b \n 2.\\f \n 3.\\n \n 4.\\r \n 5.\\t \n 6.\\v \n"); for(i=0;i<10;i++) { printf("hello,world%d\n",i); } scanf("%d",&in); switch(in) { case 1: printf("\b"); ...
C
#ifndef __GETNUMBEROFK_H__ #define __GETNUMBEROFK_H__ //õһγʱ± int GetFirstNum(int* a,int length ,int num) { for (int i = 0; i < length; i++) { if (a[i] == num) return i; } return -1; } //õһγǵ± int GetLastNum(int* a, int length, int num) { int prev = 0; int cur = 0; while (cur<length) { if (a[cur] != n...
C
#include "algorithms/aes-ecb.h" #include "algorithms/aes-cbc.h" #include <stdio.h> #include <stdint.h> #include "time.h" #include "string.h" #define ROUNDS 1000 #define MESSAGE_LENGTH 2048 // in BYTES #define KEY_SIZE 24 // in BYTES #define ECB_MODE 0 // 0=OFF, 1=ON int main(void) { printf("Starting Benchmark .....
C
#include"EQM.h" #include <stdio.h> #include<math.h> float EQ1() { char temp; printf("Which value you want to find"); scanf(" %c",&temp); if(temp=='v'||temp=='V') { float V,U,A,T; printf("Enter the value of initial Velocity"); scanf("%f",&U); printf("Enter the value of Acc...
C
// Copyright (c) Open Enclave SDK contributors. // Licensed under the MIT License. #include <getopt.h> #include <openenclave/host.h> #include <openenclave/internal/raise.h> #include <openenclave/internal/tests.h> #include "oeseal_u.h" #define COMMAND_NAME_SEAL "seal" #define COMMAND_NAME_UNSEAL "unseal" #define SKI...
C
#include <stdio.h> #include <math.h> main() { int i, N; double Arctan1 = 0, x = 1/5.0, Arctan2 = 0, y = 1.0/239; printf("Entrer un entier N: "); scanf("%d", &N); for (i = 0; i < N+1; i++) { Arctan1 = Arctan1 + pow(-1,i) * pow(x, 2*i+1)/(2*i+1); Arctan2 = Arctan2 + pow(-1,i) * pow(y, 2*i+1)/(2*i+1); } printf("...
C
#include <stdio.h> int main() { int num1, num2; char name[20]; printf("Hello user, what is your name?\n"); scanf("%s", name); printf("Hello %s\nEnter two numbers, please!\n", name); scanf("%d %d", &num1, &num2); printf("You entered: %d and %d\n", num1, num2); printf("The sum of these...
C
#include <stdio.h> #include <stdlib.h> int main() { int** A; size_t N = 50; size_t M = 60; size_t i; A = (int**) malloc(sizeof(int*) * N * M); for (i=0; i<N; ++i) { A[i] = (int*) malloc(sizeof(int) * M); } A[1][2] = 3; for (i=0; i<N; ++i) { free(A[i]); } free(A); }
C
#include <x86intrin.h> #include "complement.h" // Adapted from: https://github.com/adamkewley/reverse-complement/ extern void ssse3_reverse_complement(char* dst, const char* src, size_t len) { const __m128i shuffle_mask = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); const __m128i and_ma...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> #include <unistd.h> #include "common.h" #include "logging.h" #include "pwm.h" int pwm0_enable_fd = -1; #if GPIO_FAKE != 1 static void write_file(char* path, char * content) { int r; int fd = open(path, O_WRONLY...
C
// // Created by lucas on 25/03/17. // #include <stdio.h> #include <string.h> #include <stdint.h> #include <netinet/in.h> #include "socket.h" #include "codon.h" #include "common.h" int init_server(unsigned int port) { socket_t server, client; if (socket_create(&server)) { perror("Error creating the ...
C
#include <stdio.h> /* invert: return x with n bits beginning at p inverted */ unsigned invert(unsigned x, int p, int n) { return (x ^ (~(~0 << n) << (p+1-n))); } int main() { unsigned x = 9; printf("x is: %u\n", x); printf("invert(x, 3, 2) expect 5: %u\n", invert(x, 3, 2)); x = 13; printf("x is: %u\n", x); pr...
C
#include "krad_tone.h" krad_tone_t *krad_tone_create(float sample_rate) { krad_tone_t *krad_tone = calloc(1, sizeof(krad_tone_t)); krad_tone->sample_rate = sample_rate; krad_tone_volume(krad_tone, krad_tone_DEFAULT_VOLUME); return krad_tone; } void krad_tone_volume(krad_tone_t *krad_tone, int volume) { kra...
C
#include <stdio.h> #define SIZE 5 int q[SIZE], front = -1, rear = -1; int isFull(){ if (front == rear+1 || (front == 0 && rear == SIZE -1)) return(1); else return(0); } int isEmpty(){ if (front == -1) return(1); else return(0); } void insert(int x){ if (isFull()) puts("\nQueue Overflow"); else{ if (front ==...
C
#include<stdio.h> #include<stdlib.h> int main() { float x = 1.1; while(x==1.1) { printf("\n%f",x); x = x-0.1; } return 0; }
C
/* ** sort.c for pushswap in /home/slejeune/Elementary_Programming_in_C/CPE_2016_Pushswap/src ** ** Made by Simon LEJEUNE ** Login <slejeune@epitech.net> ** ** Started on Wed Nov 23 16:42:25 2016 Simon LEJEUNE ** Last update Thu Nov 24 14:19:50 2016 Simon LEJEUNE */ #include "../include/pushswap.h" #include <stdl...
C
#include<stdio.h> #include<conio.h> #include<math.h> char square[9]={'1','2','3','4','5','6','7','8','9'}; char player='X'; int n; void draw() { clrscr(); printf("tic tac toe v1\n"); printf("Player 1(X) - Player 2(O)\n\n"); printf("\t|\t|\t\n"); printf(" %c\t| %c\t| %c\t\n",square[0],square[1],square[2]); printf("__...
C
#pragma once #include <Windows.h> #include "register.h" typedef void(*function)(); typedef struct uThread{ registers regs;//ebp 0h;ֲй,esp 4hʼָջ,ebx 8h,edi ch,esi 10h,eip 14hָһָĵַ function func;//18h void *stack;//1ch Ϊ̵߳Ķջ int stackSize;//20hh ջС DWORD sleepTime;//24h ˯߿ʼʱ---ֻstatusΪUtStatusSleepʱ DWORD sleepD...
C
#include <stdio.h> #include <stdlib.h> typedef struct node { int altura; int countdireita; int countesquerda; int number; struct node *left; struct node *right; }node; struct arvore { int cont; node **pai; }; typedef struct arvore arvore; node *add(int n2, node *noderaiz) { node *...
C
#include <stdio.h> #include "type.h" #include "SHA224.h" /*ʼϣֵ*/ static const u32 SHA224_H[8] = { 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4}; /*ȫֱÿϣֵ*/ u32 SHA224_H1[8]; /*ʼ*/ static const u32 SHA224_K[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x395...
C
#include "header.h" unsigned int get_v1(t_vm *vm, int i) { if (vm->procs[i]->instruc.type_params[0] == T_REG && reg_correct(vm->procs[i]->instruc.params[0])) return (get_value_inside_reg((unsigned char *) vm->procs[i]->reg[vm->procs[i]->instruc.params[0] - 1])); else if (vm->procs[i]->instruc.type_params[0...
C
#include <stdio.h> #include <stdlib.h> #include <sys/times.h> #include <sys/resource.h> #include <unistd.h> static void pr_times(clock_t, struct tms *, struct tms *); static void do_cmd(char *); int main(int argc, char *argv[]) { int i; setbuf(stdout, NULL); for (i = 1; i < argc; ++i) { ...
C
/** ****************************************************************************** * @file exercise3.c * @author MDS, NPG * @date 05122017 * @brief Enable the ADC1 on pin A0. * See Section 13 (ADC), P385 of the STM32F4xx Reference Manual. ************************************************...
C
#include "student.h" #include <stdio.h> #include <string.h> #include <stdlib.h> Student *new_student(const char name[], unsigned int id, float shoe_size){ Student *s; s = malloc(sizeof(Student)); if(name == NULL){ s->name = malloc(1); s->name = ""; } else{ s->name = malloc(strlen(name) + 1); ...
C
#include "pstring.h" char * pstrcpy(char * __restrict destination, char * __restrict source) { if (destination == NULL) { // destination is not allocated. return NULL; } char * origin = source; while(*destination++ = *source++); return origin; }...
C
#include "search.h" //Function to bubble_sort int bubble_sort (int array[], int size) { int i , j; //Loop to sort elements for (i = 0; i < size; i++) { for (j = 0; j < size-i-1; j++) { if (array[j] > array[j+1]) { swap(&array[j],&array[j+1]); } } } return SUCCESS; }
C
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * * src/mailbox.c * * BCM2835 VideoCore mailboxes * * Author: Daniel Kudrow (dkudrow@cs.ucsb.edu) * Date: March 7 2014 * * Copyright (c) 2014, Daniel Kudrow * All rights reserved, see LICENSE.txt for details. * * ~~~~~~~~~~~~~~~~~~~...
C
#include <hash.h> #include <searchlib.h> #include <assert.h> #include <ctype.h> enum { NHASH = 3571 }; void cswap(char * str, int a, int b) { char tmp; tmp = str[a]; str[a] = str[b]; str[b] = tmp; } void strsort(char * str, int len) { int last = 0, i = 0; if (len == 0) return; cs...
C
#include <stdio.h> int ft_str_is_printable(char *str); int main(void) { char a[] = "\(null)"; char *b = a; int resultado; resultado = ft_str_is_printable(b); printf("resultado: %d", resultado); return (0); }
C
#include <assert.h> #include "bounds.h" void bounds( const double *x, int n, double mm[] ) { // If there is at least one element... if( n-- > 0 ) { // ...initialize results from it, and "mark it" as used. double m = *x; double M = *x++; // Continue only as long as there are more elements. assert( m...
C
#include "hal.h" #include "drv_pwm.h" #include "config.h" #define PULSE_1MS (1000) // 1ms pulse width #define MWII_PWM_MAX 1000 #define MWII_PWM_PRE 1 // returns whether driver is asking to calibrate throttle or not bool pwmInit(drv_pwm_config_t *init) { CLK_EnableModuleClock(PWM01_MODULE);...
C
//receber valores em um vetor e imprimir ORDENADO se o vetor estiver em ordem crescente #include <stdio.h> #include <stdlib.h> int bubbleSort(int *vetor, int n); int main(){ int n = 5; int vetor[5] = {1, 2, 3, 4, 5}; if(bubbleSort(vetor, n)){ for(int i = 0; i < n; i++) printf("%d ", vetor[i]); } puts(""); ...
C
#include "common.h" int main() { s_array *s = malloc(sizeof(s_array)); //validation if(s == NULL) { printf("memory allocation unsuccessful\n"); exit(0); } s->top = -1; data_t data; int opt, status; while(1) { printf("Enter the option 1. PUSH\n 2. POP\n 3. PEEP\n 4. PEAK \n"); scanf("%d", &opt); pri...
C
#include "p5lib.h" // Learning Processing // Daniel Shiffman // http://www.learningprocessing.com // Example 5-2: More conditionals // Three variables for the background color. float r = 0; float b = 0; float g = 0; void setup() { p5_size(480,270); p5_frameRate(10); } void draw() { // Color the background ...
C
#include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> int main() { char buffer[1000]; int i; int rtn; while ((rtn = read(0, buffer, 1000)) > 0) { for(i = 0; i < rtn; i++) if(islower(buffer[i])) buffer[i] = toupper(buffer[i]); write(1, buffer, rtn); write(1, "\n", 1); } exi...
C
/* << ˰ >> - : prim ˰ Ͽ Ʈ ܰ Ȯس ̴. ܰ迡 Ʈ տ Եȴ. prim Ʈտ, ߿ Ͽ Ʈ ȮѴ. Ʈ n-1 ӵȴ. Ʒ ׸ ̹ Ʈ տ { a, f } ԵǾ ִ. ¿ Ʈ տ 캸 be ִ.( a, b ) ( f, e ) ġ ( f, e ) 27μ ( a, b ) 29 . ( f, e ) õǰ e Ʈ տ Եȴ. ܰ迡 Ʈ { a, f, e } ǰ Ǯ ȴ. Ʈ տ n-1 ӵȴ. */ #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #d...
C
void createGraphics() { int tmp[4][2] = { {0,1},{1,0},{-1,0},{0,-1} }; //上 右 左 下 memset(map, 0, sizeof(map));//把圖初始化為0 for (i = 0; i < row*column; i++) { //找到該點上下左右4個點初始map int r = i / column;//X軸座標 int c = i % column;//Y軸座標 for (j = 0; j < 4; j++)//每個點最多有4個路徑 { //(r,c)相鄰的點為(r1,c1) int r1 = r + tm...
C
/* LINKSYNC.C :Electronic gearing with synchronization based on I/O sensors. This sample code link's two axes together and commands a velocity move on the master axis. During the motion, the actual position of the slave axis is displayed based on two input sensors. For this sample, the index inputs are us...
C
/* Team 14 Name : Umang Maurya Roll no : 055 Name : Amardeep Singh(Lata) Roll no : 009 Name : Yateesh Chandra Roll no : 057 Name : Sachin Verma Roll no : 038 */ #include<stdio.h> #define input "Input.txt" #define output "Output.txt" /****************...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #include "net.h" #define BACKLOG 10 // how many pending connections queue will hold /** * This gets an Internet address, either IPv4 or IPv6 * ...
C
#ifndef STRUCT_STRING_ARRAY #define STRUCT_STRING_ARRAY #include <string.h> typedef struct s_string_array { int size; char **array; } string_array; #endif char *my_join(string_array *param_1, char *param_2) { char *strings = malloc(sizeof(char)); int arr_size = param_1->size - 1; for (int i = 0; i < arr_siz...
C
#include <pebble.h> static Window *main_window; static Layer *ticks, *hands; static TextLayer *date; static GPath *minute_hand, *hour_hand; static const GPathInfo MINUTE_HAND_POINTS = { .num_points = 6, .points = (GPoint []) { {2, -72}, {5, -20}, {2, 0}, {-2, 0}, {-5, -20}, {-2, -72}} }; static...
C
#include "dynarray.h" #include "command.h" #include "program.h" #include "token.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> /* A command consists of name and arg token in a DynArray as well as file redirect strings */ struct Command { /* Command name and Comman...
C
#include<stdio.h> #include<math.h> int isPrime(int); int main() { int n; printf("enter a no.\n"); scanf("%d",&n); isPrime(n)?printf("%d is prime\n",n):printf("%d is not prime\n",n); } int isPrime(int num) { if (num==0||num==1) return 0; for(int i=2;i<=sqrt(num);i++) if (num%i==0) ...
C
#include "circ_linked_list.h" /* Gives the length of given linked list */ int length(list *l) { int i = 1; node *ptr = *l; if (*l == NULL) { return 0; } while (ptr->next != *l) { ptr = ptr->next; i++; } return i; } /* Initializes the list to NULL */ void init(list *...
C
/*Tokenizer project using Linked List Structure to hold data*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /* Token Structure is based off a linked list This was done so that we could store the tokens easily and then be able to easily find a token or remove a token if needed */ str...
C
#include "holberton.h" /** * _memset - fills n memory spaces with the constant char b * * @s: adress of memory * @b: constant char * @n: numbers of fields to fill * * Return: return the adress of the memory */ char *_memset(char *s, char b, unsigned int n) { unsigned int i; for (i = 0; i < n; i++) { *(s...
C
#include<stdio.h> int binary_search(int a[],int lb,int ub,int ele) { int mid; if(lb<ub) { mid=(lb+ub)/2; if(a[mid]==ele) { return (mid+1); } else if(a[mid]<ele) { return binary_search(a,mid+1,ub,ele); } else { return binary_search(a,lb,mid-1,ele); } } else { return -1; }...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> int main(void) { FILE * data; double f, f1, f2, g1, g2, dx, x, k1, k2, k3, k4, k, h1, h2, h3, h4, h; int a, b; data = fopen("problem_data.csv", "w"); printf("aを入力して下さい。 a = "); scanf("%d", &a); printf("bを入力して下さい。 b = "); scanf("%d", &b); printf("yを入力して下さい。 y = "); sca...
C
#include<stdio.h> #include<conio.h> { char y; char x[5]={'a','e','i','o','u'}; scanf("%d",&x); if(y==x[5]) printf("vowel"); else printf("consonent"); }
C
#include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" // #include "procstat.h" #include <stddef.h> int main(int argc, char *argv[]) { int k, n, id; // double x = 0, z; // set_priority(4, 70); if (argc < 2) n = 1; // default value else n = atoi(argv[1]); // from...
C
#include<stdio.h> int Fibonacci(int n) { if(n <=2)return 1; return Fibonacci(n-1)+Fibonacci(n-2); } int Fibonacci2(int n) { if(n <=2)return 1; int fn1 = 1; int fn2 = 1; int fn; int i; for(i = 3;i <= n;i++ ) { fn = fn1+fn2; fn2 = fn1; fn1 = fn; } return fn; } int main() { printf("%d\n",Fibonacci2(...
C
#include <stdio.h> int main() { float i=1000,r1=0.0468,r2=0.054,p1,p ; int n1=2,n2=3 ; p1=i*(1+n1*r1) ; p=p1*(1+n2*r2) ; printf ("p=%f",p) ; return 0 ; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* init.c :+: :+: :+: ...
C
#include "AD5410.h" void DA_SendByte(unsigned char byte); extern u8 data_ReadFormRegister[3]; void DA_control(unsigned char addr,unsigned int data) ; void AD5410GpioInit() { GPIO_InitTypeDef g; g.GPIO_Mode=GPIO_Mode_Out_PP; g.GPIO_Speed=GPIO_Speed_50MHz; g.GPIO_Pin=GPIO_Pin_10; //5410_CLEAR GPIO_Init(GPIOB,...
C
#include<stdio.h> int main (void){ int n, i, j, k, t; double h; double max[100] = {0}; scanf("%d", &t); for(k = 0; k < t; k++){ scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%lf", &h); if(h > max[k]){ max[k] = h; } } } for(j = 0; j < t; j++){ printf("%.2f\n", max[j]); } ...
C
#include "libkl.h" void kl_putstr(char *str) { int j = 0; while (str[j] != '\0') { kl_putchar(str[j]); j++; } }
C
/* ** EPITECH PROJECT, 2019 ** my_rpg_2018 ** File description: ** init_ennemie */ #include "prototype.h" void create_zone_enn(obj_t *ennemie, int zone) { sfFloatRect size_sp = sfSprite_getGlobalBounds(ennemie->sprite); sfVector2f size; sfVector2f pos; pos.x = size_sp.left + size_sp.width / 2; po...
C
/** * Copyright (c) 2018, * National Instruments. * All rights reserved. * * Overview: * Demonstrates how to use the timer IRQ. Once the timer IRQ occurs (5 s), print * the IRQ number, triggered times and main loop count number in the console. * The timer IRQ will be triggered only once in this example. * The ...
C
int isSameTree(treenode* A, treenode* B) { if(A==NULL&&B==NULL) return 1; if((B==NULL)||(A==NULL)||(A->val!=B->val)) return 0; int x=isSameTree(A->left,B->left); int y=isSameTree(A->right,B->right); if(x==1&&y==1) return 1; return 0; }
C
#include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> void fatal(char *str){ perror(str); fflush(stdout); exit(1); } int main(){ int fd; struct flock first_lock; struct flock second_lock; first_lock.l_type=F_WRLCK; first_lock.l_whence = SEEK_SET; first_lock.l_start = 0; first_lock.l...
C
#ifndef FILE_HANDLER_H #define FILE_HANDLER_H ///FILE* file; // This is in constants, because it needs to be accessed by objectSave/Load functions. void File_saveTiles(){ for (int x=0; x<WORLD_SIZE_X; ++x) { for (int y=0; y<WORLD_SIZE_Y; ++y) { for (int z=0; z<WORLD_SIZE_Z; ++z)...
C
/* ** invalid_null_cmd.c for in /home/beche_f/PSU_2015_42sh/src/syntaxe ** ** Made by beche_f ** Login <beche_f@epitech.net> ** ** Started on Wed May 25 15:22:26 2016 beche_f ** Last update Wed May 25 15:40:44 2016 beche_f */ #include <stdio.h> #include <stdlib.h> #include "list.h" #include "lib.h" int begin_by_t...
C
/** * @file ctre.h * Common header for all CTRE HAL modules. */ #ifndef CTRE_H #define CTRE_H //Bit Defines #define BIT0 0x01 #define BIT1 0x02 #define BIT2 0x04 #define BIT3 0x08 #define BIT4 0x10 #define BIT5 0x20 #define BIT6 0x40 #define BIT7 0x80 #define BIT8 0x0100 #define BIT9 0x0200 #define BIT10 0x0400 #...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /*rle: String Operations II *Takes a single arguement *Compresses a string for each repeating letter or punctuation *-If the compress string it longer than the orginal string, print orginal string *-If the string contains a # program mu...
C
/* filename - main.c version - 1.0 description - ⺻ Լ -------------------------------------------------------------------------------- first created - 2020.02.01 writer - Hugo MG Sung. */ #include <stdio.h> #include <stdlib.h> // Լ int main(void) { int a; int n[20][20]; scanf("%d", &a); ...
C
#include<stdlib.h> #include<stdio.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<errno.h> #include<string.h> #include<stdbool.h> #include<linux/limits.h> #define BUF_SIZE 1024 // 仿写 cp 命令 // usage: ./my_cp src_file dest(file or dir) static bool file_exists(char *filename) { struct stat buffer...
C
/* 㵽n׵ʱֵ﷽ʽ n-1 1¥ݡn-22¥ N¥ݵ=n-1+n-2 ƹʽͳ fn=fn-1+fn-2 */ #include <stdio.h> int main() { int n,a[45],m,i; a[1]=1; a[2]=1; while(scanf("%d",&n) != EOF) { for(i=3;i<=45;i++) a[i]=a[i-1]+a[i-2]; while(n--) { scanf("%d",&m); printf("%d\n",a[m]); } } return 0...
C
/* * Copyright (c) 2018 James, https://github.com/zhuguangxiang * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, ...
C
#pragma once struct Books { unsigned int publ_date_day : 5; // Дата издания.День unsigned int publ_date_month : 4; // Дата издания.Месяц unsigned int publ_date_year : 11; // Дата издания.Год char title_book[50]; // Название. char author_name[20]; // Автор.Имя ...
C
#include <math.h> #include "snackpack/snackpack.h" #include "snackpack/internal/blas1_real_internal.h" /* sasum for vectors with inc_x = 1 */ float sp_blas_sasum_inc1( len_t n, const float * const x) { float tmp = 0.0f; for (len_t i = 0; i < n; i++) { tmp += fabsf(x[i]); } return tmp;...
C
/** * Ohjelma muuntaa dollarit euroiksi, käyttäjä syöttää dollareiden määrän. * 180919 Johanna Lyytinen */ #include <stdio.h> const float rate = 0.90; int main() { float dollars = 0; float euros = 0; printf("Syötä dollarit: \n"); scanf("%f", &dollars); euros = dollars * rate; printf("%.4f...
C
/* Bounded Variable Least Squares * * Solves the Bounded Variable Least Squares problem (or box-constrained * least squares) of: * minimize ||Ax - b|| * x 2 * * given lb <= x <= ub * * where: * A is an m x n matrix * b, x, lb, ub are n vectors * * Based on the article Stark and Parker "Bounded...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(int argc, const char * argv[]) { if ( argc < 2 ) { printf("Not enough arguments, Exiting...\n"); return 0;} FILE *file = fopen(argv[1], "r"); const int MAX_CHAR = 1000000; char line[MAX_CHAR]; // ^--: <100 friends w...
C
/* * ADC_TEST_Q6.c * * Created: 17/04/2020 06:31:46 م * Author : Abdel-Rahman *Requirements : -Select ADC1 as input channel - ADCSRA prescaler /128 - ADCSRA auto trigger mode -polling -ADMUX right adjust( no left adjust) -internal reference 2.56v */ #include <avr/io.h> #include <avr/interrupt.h> #include <...
C
#include<stdio.h> int main() { int n,i,arr[105],x=arr[0],y=arr[0]; scanf("%d",&n); printf("Enter the size of the Array:%d",n); printf("\nEnter Array values: "); for(i=0; i<n; i++) { scanf("%d",&arr[i]); } for(i=0; i<n; i++) { if(x<arr[i]) { x=arr[i];...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
// IMplementation of prefix to postfiz using Stack (implemented using Stack) #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct _Stack { int top; unsigned int capacity ; char *array; }Stack; //Stack implementation //Create a new stack Stack * createStack(int capacity){ //imp Stack *s...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> #include "gmp.h" #include "function.h" #include "key.h" /* ** Key(); ** */ static unsigned long int seed = 1; void key(key_gpq_t *key, mpz_t Ks, mpz_t Kp) { //Cacul d'un nombre aléatoire entre 2 et p-2 (Ks) mpz_t tmp; gmp_randstate_t state; ...
C
#include "timestep.h" #include "settingsProgram.h" void timestepInit( timestep *const restrict step, const float updateRate, const float renderRate, const float timeSpeed ){ // Updates/renders per second. step->updateRate = updateRate; step->renderRate = renderRate; // Seconds per update/re...
C
#include <stdio.h> int main() { int a; int result; int temp; int i; while(scanf("%d", &a) != EOF) { result = 1; for (i = 0; i < a; ++i) { scanf("%d",&temp); if(temp % 2 == 1) result = result * temp; } printf("%d\n", result); } return 0; }
C
//633_Sum_of_Square_Numbers.h //3ms 99.85% /* Total Accepted: 8.1k Total Submissions: 25.7k Instruction: LeetCode 633 - Sum of Square Numbers - [E] Developer: lrushx Process Time: Aug 14, 2017 */ /* Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a^2 + b^2 = c. ...