language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
int main()
{
int i,n,j;
printf("enter the number.......\n");
scanf("%d",&n);
for(j=n;j>=0;j--)
{
for(i=0;i<2*n-1;i++)
{
printf("%c ",'A'+i);
}
printf("\n");
}
}
|
C | /******************************************************************************
* Copyright (C) 2017 by Alex Fosdick - University of Colorado
*
* Redistribution, modification or use of this software in source or binary
* forms is permitted as long as the files maintain this copyright. Users are
* permitted to mod... |
C | /*
*
* Fork - for fusion
* (c) 1999 Jimmy Larsson
*
*/
#include "process.h"
#include "syscall.h"
#include "printk.h"
#include "fork.h"
/*
* Fork 'source' and put the new process in
* run queue
*
* returns pid of new child
*/
int do_fork (process_t *source)
{
process_t *new_child;
new_child = get... |
C | //Program to implement queue ADT using singly linked list
//Author: Taniya Kulkarni
#include <stdio.h>
#include "COE19B046_list.h"
void main()
{
int choice;
create_queue();
do{
printf("\nChoose what operation you wish to do: \n 1. Enqueue \n 2. Display \n 3. Dequeue \n 0. Exit \n Ente... |
C | #include<stdio.h>
int main(int argc, char *argv[])
{
float ancho = 0;
float largo = 0;
float perimetro = 0;
float area = 0;
printf("Ancho del terreno (u): ");
scanf("%f",&ancho);
largo = ancho * 3;
perimetro = largo*2 + ancho*2;
area = largo * ancho;
printf("perimetro: %.3f u... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "traductor.h"
#include "emulador.h"
#include "cadenas.h"
#define AAC 160 //ascii letra "a" con acento
#define IAC 161 //ascii letra "i" con acento
#define OAC 162 //ascii letra "o" con acento
/*
Devoluciones funcion Emulador
0 = Emul... |
C |
/*-------------------------------------------------------------
系统PTE区域的管理支持
修改时间列表:
2011-01-08 15:00:40
2011-01-14 22:37:24
-------------------------------------------------------------*/
#include "ke.h"
#include "proto.h"
/*-------------------------------------------------------------
... |
C | /** \file list.c
*
* \brief Implementation of a list library
*
** \copyright Copyright (c) 2020, Alma Mater Studiorum, University of Bologna, All rights reserved.
*
* \author Lorenzo Persampieri, lorenzo.persampieri@studio.unibo.it
*
* \par Supervisor
* Carlo Caini, carlo.caini@unibo.it
*/
#include... |
C | #include "common.h"
#include "mem.h"
#include "mem_os.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_REALLOC 200
int structure_libre(){
struct head * entete = get_memory_adr();
struct fb* tete_libre = entete->tete_bloc_libre;
int i = 0;
while(tete_libre != NULL){
tete_... |
C | //-----------------------------------------------------------------------------
// Anton Kozintsev
// 1647521
// akozints@ucsc.edu
// IntegerQueue.c
// LinkedList based implementation of Integer Queue ADT in C
//-----------------------------------------------------------------------------
#include<stdlib.h>
#in... |
C | #include <stdio.h>
#include <stdlib.h>
/* Victor Hugo Faim
victorfaim@hotmail.com
Faça um programa que receba a medida de dois ângulos de um triângulo, calcule e mostre a medida do
terceiro ângulo. Sabe-se que a soma dos ângulos de um triângulo é 180 graus*/
int main ()
{
float ang1, ang2, ang3;
//Entrada de... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "data.h"
int8_t * my_itoa(int8_t * str, int32_t data, int32_t base)
{
int8_t sign=1, val, count=0, i=0, temp, j = 0; // defining local variables
if(base>2 || base<=16) // checking for base: it can't be other than 10 or 16
;
else
{
printf("h... |
C | #include<stdio.h>
main()
{
int i,space,rows,k=0;
printf("Enter row number:");
scanf("%d",&rows);
for(i=1;i<=rows;++i);
{
for(space=1;space<=rows-1;++space)
{
printf(" ");
while(k!=i)
{
printf(" * ");
++k;
}
}printf("\n");
}
}
|
C | /********************************
* Module: UART *
* Author: Josh Chen *
* Date: 2016/03/23 *
********************************/
#include <stdio.h>
#include <termios.h>
#include <fcntl.h>
#include <string.h>
#include "uart.h"
int uart_open(uart *uart)
{
struct termios cfg;
... |
C | /*
* Tranceiver.c
*
* Created: 13/09/2015.
* Last modified: 22/09/2015.
* Authors: Alex Fernicola, Rebecca Hopping and Samuel Janetzki.
*/
void InitAlpha()
{
unsigned int data;
data = 0x8011; // Configuration Setting
PushSPI(data);
data = 0x8219; // Power Management
PushSPI(data);
... |
C | #include <stdlib.h>
#include <stdio.h>
#include "file.h"
// Initialisation de la file
void initialization(Queue* file){
file->first = NULL;
file->last = NULL;
file->size = 0;
}
int emptyFile(Queue* file){
if(file->size == 0)
return 1;
else return 0;
}
//Taille de la file
int size(Queue* file){
retur... |
C | #include<stdio.h>
main()
{
int a;
printf("enter the no:");
scanf("%d",&a);
twice(&a);
printf("the doubled no is:%d\n",a);
}
twice(int *x)
{
*x=*x*2;
}
|
C | #ifndef FREQ_LIST_H
#define FREQ_LIST_H
#include <stdbool.h>
#include <stdlib.h>
#include "common.h"
typedef struct _freqList FreqList;
/** Create a Frequency List, and return it */
FreqList* freq_list_create();
/** Destroy the frequency list and free every element */
void freq_list_free(FreqList* list);
/** Sear... |
C | #include <sys/ioctl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <stdbool.h>
#include <fcntl.h>
void enable_raw_mode() {
struct termios term;
tcgetattr(STDIN_FILENO, &term);
term.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &term);
}
void disable_raw_mode()... |
C | // MergeImage.c
// Nicholas Culmone
// A program that takes in two PPM P6 images and merges them by making a new file
// which places the second one in the top-right corner of the first one.
// INCLUDE SECTION
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
// FUNCTION DEFINITIONS FOLLO... |
C | /***************************************************************/
/** **/
/** Marcos Kazuya Yamazaki 7577622 **/
/** Exerccio-Programa 03 **/
/** ... |
C | #include <iostream>
#include "timer.h"
void diff(timespec* start, timespec* end, timespec* diff)
{
if( (end->tv_nsec-start->tv_nsec) < 0 )
{
diff->tv_sec = end->tv_sec-start->tv_sec-1;
diff->tv_nsec = 1000000000LL+end->tv_nsec-start->tv_nsec;
}
else
{
diff->tv_sec = end->tv_sec-start... |
C | /*
*Name: Nikhil Ranjan Nayak
*Regd No: 1641012040
*Desc: print iter, 3 times
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int pid, pid2;
pid = fork();
if(pid)
{
pid2 = fork();
printf("iter\n");
}
else
{
printf("iter\n");
pid2 = fork();
}
return 0;
}
|
C | /**
@file
@author Andrew D. Zonenberg
@brief Main program include file
*/
#ifndef sim_h
#define sim_h
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// System headers
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <linux/el... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "lists.h"
/**
* sum_dlistint - check the code for Holberton School students.
* @head: given list
* Return: Always 0.
*/
int sum_dlistint(dlistint_t *head)
{
if (head == NULL)
return (0);
return (head->n + sum_dlistint(head->next));
}
|
C | #include<stdio.h>
int main()
{
char name[20],type;
int i ,countS=0 , countC=0 ,countT=0;
FILE *cPtr;
cPtr = fopen("appoinment.dat","w");
if(cPtr==NULL)
{
printf("Can't open file");
return -1;
}
for(i=1; i<=5; i++)
{
printf("Enter patient name and appoinment type :");
scanf("%s... |
C | #include <irc_client.h>
/*
** Check if the command is a client side command or it has to be transmitted to
** the server.
*/
int is_client_side_command(t_cl_prop *cl, char *s)
{
int i;
char **cmda;
i = 0;
cmda = lexer(s);
while (i < CL_BIN)
{
if (!ft_strncmp(cmda[0], cl->bin[i].name, ft_strlen(cl->bin[i].n... |
C | #include <stdio.h>
#include <string.h>
int main(){
char string[200];
printf("Enter any string: ");
scanf("%[^\n]", string);
printf("Reverse string: ");
int i;
for (i = strlen(string); i >= 0; i--) {
printf("%c", string[i]);
}
printf("\n");
return 0;
}
|
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include "SortedList.h"
void SortedList_insert(SortedList_t *list, SortedListElement_t *element) {
// Check for NULL list/element
if (list == NULL | element == NULL) {
fprintf(stderr, "%s\n", "Error: NULL list or e... |
C | #include<stdio.h>
#include<stdlib.h>
struct BSTNode
{
int data;
struct BSTNode *left,*right;
};
typedef struct BSTNode BSTNode;
BSTNode* insert(BSTNode* root,int val)
{
if (root==NULL)
{
root=(BSTNode*) malloc(sizeof(BSTNode));
root->data=val;
root->left=NULL;
root->right... |
C | #include <stdio.h>
//prototypes
void sort(char *str, int n)
{
printf("i came this far1\n");
//initialize the variables
int i = 0, j;
j = i + 1;
while(j < n)
{
if(str[j] == 'R')
{
char temp = str[j];
str[j] = str[i];
str[i] = temp;
i++;
}
j++;
}
printf("i came this far2\n");
j = i + 1;... |
C | #include "holberton.h"
#include <stdio.h>
#include <stdlib.h>
/**
* array_range - creates an array of integers
* @min: first array
* @max: second array
*
* Return: the pointer to the newly created array. Otherwise if min > max or
* malloc fails, return NULL
*/
int *array_range(int min, int max)
{
int *array;
... |
C | //DEKODER
#include <stdio.h>
#include <stdlib.h>
#define CONST 1
int main()
{
char c[900];
gets(c);
//printf("\n%s", c);
int n = strlen(c);
// printf("\n%d\n", n);
char s[n/3];
for(int i=0; i<n; i+=3)
{
if (c[i+1]==(char) 110)
{
s[i/3] = c... |
C | mmap(memery-mapped I/O)可以将一个文件或其他对象(比如一段匿名内存)映射到进程的虚拟地址空间。
mmap技术的用途主要有以下两个方面:
[1]. 将一个文件映射到进程的虚拟地址空间后,进程就可以直接访问这段虚拟地址来进行文件的I/O操作,而不再需要使用read、write等系统调用
[2]. 多个进程可以通过映射同一个文件实现共享内存,来作为进程间的一种IPC方式
mmap接口格式:
void *mmap(void *addr,size_t len,int prot,int flag,int fd,off_t off);
@addr - 用于指定映射区域的起始地址。通常设置... |
C | /*
* File name : breathingLed.c
* Description : control the brightness of led by PWM.
* Company : SunRobotics Technologies
* Website : www.sunrobotics.co.in
* E-mail : support@sunrobotics.co.in(For Any Query)
*/
#include <wiringPi.h>
#include <stdio.h>
#define LedPin 12
int main(void)
{
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/ip.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "ds11_aux.h"
/* Server code - This server is able to handle just one connection at
the time */
#define MAX(x, y) (((x) > (y)) ? (x) : (y... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>
int main()
{
int fd;
char buff[1];
fd = open("testfile.txt",O_RDONLY,(mode_t)0700);
while(read(fd,buff,1) > 0)
write(1,buff,1);
close(fd);
... |
C | #include<stdio.h>
#include<conio.h>
#include<malloc.h>
typedef struct que
{
int info,prio;
struct que *next;
}nodetype;
void insert(nodetype**,nodetype**,int,int);
void serve(nodetype**,nodetype**);
void display(nodetype*);
void main()
{
nodetype *front=NULL,*rear=NULL;
int ch,pr,num,c=0;
printf("Me... |
C | /*
Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear atmost twice and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
Note that even though we want you to return the new length,... |
C | #include "vm.h"
#include "lexer.h"
#include "cmd_parse.h"
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef int inst_t;
struct vm_context {
int status;
size_t capacity;
size_t length;
int inst_base[];
};
struct vm_cont... |
C |
/* @(#)e_pow.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <definitions.h>
#include <functions.h>
void calculate_mark(char *student, int mark);
double calculate_mean();
void send_mean(double mean, char *write_fd);
int main(int argc, char *argv[])
{
/*Install child... |
C | #include <stdint.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <inttypes.h>
struct marble {
unsigned ccw;
unsigned cw;
};
static void
insert_cw_after(struct marble *marbles,
unsigned pos,
... |
C | // mode_sizes.c
// demonstrate a problem with 'ping'
// /usr/include/sys/types.h, around line 177, after macro expansion
typedef int int8_t __attribute__ ((__mode__ ( __QI__ ))) ;
typedef int int16_t __attribute__ ((__mode__ ( __HI__ ))) ;
typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
typedef int int6... |
C | /*
** swap_my_tab.c for in /home/armin.pc/delivery/PSU/PSU_2016_42sh
**
** Made by Enguerrand Arminjon
** Login <armin.pc@epitech.net>
**
** Started on Fri Apr 14 10:18:49 2017 Enguerrand Arminjon
** Last update Fri May 19 11:34:12 2017 Enguerrand Arminjon
*/
#include <stdlib.h>
#include "my.h"
char *after_star(c... |
C | #include<stdio.h>
#include<string.h>
void main()
{
int i=0,count=0;
char a,aa[50];
printf("enter a string:");
gets(aa);
printf("which charecter do you want to check:");
scanf("%c",&a);
while(aa[i]!=0)
{
if(aa[i]==a)
count++;
i++;
}
printf("the number of the checking chare... |
C | /* DISKP.C -
* This is a program to figure out if there are enough pages
* remaining on a structure. Input is a structure name followed
* by the number of pages needed on the structure. Nothing
* is returned if there are enough... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "fungsi.h"
//#include "menu.h"
typedef struct{
char nama[30];
char ID[20];
char alamat[50];
char motor[30];
char tanggal_sewa[20];
char tanggal_kembali[20];
}data_diri;
typedef struct{
char plat[15];... |
C | #include <stdio.h>
#include <malloc.h>
int main(int argc, char* argv[])
{
char * buf;
int i;
char a[10] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
buf = malloc(sizeof(10 * sizeof(char)));
for(i = 0; i < 9; i++)
{
*buf = a[i];
buf++;
}
buf = buf - 9;
for(i = 0; i < 9; i++)
{
printf("%c ",... |
C | //
// Created by Daniel on 10/06/2018.
//
#include <memory.h>
#include "hashtable.h"
const int max = 2500009;
int size = 0;
int prime = 2499997;
struct hashtable_item *array;
int hashcode1(unsigned long long key)
{
return (key % max);
}
int hashcode2(unsigned long long key)
{
return (pr... |
C | /*! \file
*/
#include "nanotest.h"
#include <stdio.h>
TESTCASE(assertion);
TEST(assertion, uint_eq) {
ASSERT_EQ(0, 0);
ASSERT_EQ(0, 1);
ASSERT_EQ(0, 2);
ASSERT_EQ(0xffffffff, 0);
ASSERT_EQ(0xffffffff, 1);
ASSERT_EQ(0xffffffff, 0xffffffff);
}
TEST(assertion, uint_ne) {
ASSERT_NE(0, 0);
ASSERT_NE(0, ... |
C | #ifndef hash_h
#define hash_h
#include <stdio.h>
#include "palavra.h"
typedef struct hash Hash;
Hash* inicHash(int tamanho);
//Faz acesso à hash realizando 2 possíveis operações:
//1) inserção, caso a palavra não esteja na hash
//2) incremento de ocorrência, caso a palavra já esteja na hash
Palavra* acessa(Hash* h, ... |
C | /*
** lro_fm_crc
**
** This program calculates the CRC of a given file using the same
** algorithm as the LRO spacecraft flight software File Manager task uses.
**
** Inputs: One string containing the filename of the file for which to calculate the CRC.
** Optional decimal number of bytes to skip before st... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: ... |
C | #include<stdio.h>
main(int argc,char**argv)
{
int i;
printf("%d\n",argc);
for(i=0;i<argc;i++)
printf("argv[%d]=%s\n",i,argv[i]);
}
|
C | #include<stdio.h>
int main()
{
int a,n,i,j,c,p,k;
int temp[101];
while(scanf("%d",&a)==1)
{
for(k=1;k<=a;k++)
{
c=0;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&temp[i]);
for(i=1;i<n;i++)
for(j=n-1;j... |
C | #include <stdio.h>
#include <stdlib.h>
void tri(int* list, int size)
{
int i,j,c=0;
for(i = 0 ; i < size; i++)
{
c =0;
for(j = i+1 ; j < size; j++)
{
int t;
if(list[i]> list[j])
{ t=list[i];
list[i] = list[j];
list[j] = t;
c=1;
}
}
if (!c)
return;
}
}
int main(int argc , c... |
C | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif if // _MSC_VER
#include <stdio.h>
#include <stdlib.h>
int main()
{
double weight, height, BMI;
printf("(kg) Ű(cm) Է : ");
scanf("%lf %lf", &weight, &height);
BMI = weight / ((height/100.0) * (height / 100.0));
if ((BMI <= 25.0) && (BMI >= 20.0))
{
pri... |
C | #include <stdio.h>
#include "../Sources/module3/include/header.h" /* Include the header here, to obtain the function declaration */
// To compile, use:
// clang a_c_program.c ../Sources/module3/header.c -o a_c_program
// https://www.youtube.com/watch?v=3_usxcieDns
int main()
{
int result = add(3, 10); /* Use the... |
C | #include "lists.h"
/**
* get_dnodeint_at_index - retunr the nth node
* @head: pointer received
* @index: int received
* Return: Always EXIT_SUCCESS.
*/
dlistint_t *get_dnodeint_at_index(dlistint_t *head, unsigned int index)
{
dlistint_t *tmp = NULL;
unsigned int i; /*to check the number of node I'm in */
if ... |
C | #include <curses.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#define min(x, y) x<y?x:y
#define max(x, y) x>y?x:y
int maxx, maxy;
void rectangle(int y1, int x1, int y2, int x2)
{
attron(A_BOLD); //Attribute ON
mvhline(y1, x1, 0, x2-x1);
mvhline(y2, x1, 0, x2-x1);
mvvline(y1, x1, 0, y2-y... |
C | #include "holberton.h"
/**
* puts_half - prints half of a string
* @str: pointer
*
*/
void puts_half(char *str)
{
int aux1, count = 0, half;
aux1 = 0;
while (str[aux1] != 0)
{
count++;
aux1++;
}
half = count / 2;
if (count % 2 == 0)
{
aux1 = half;
while (str[aux1] != 0)
{
_putchar(str[aux1]... |
C | #include<stdio.h>
#include<string.h>
#define getpos(array,i) (array[i/8]>>(7-(i%8))&1)
#define setpos(array,i) (array[i/8] |= (1<<(7-(i%8))))
#define clrpos(array,i) (array[i/8] &= ~(1<<(7-(i%8))))
int result[10004];
int rescnt;
unsigned char isPrime[1252];
int superprime[10004];
int spcnt;
int minstep[10004];
int... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* screenshot.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "playlist.h"
void add_song( char s[], char a[] ) {
printf("adding %s - %s...\n", s, a);
char letter = a[0]-97;
lst[letter] = insert(lst[letter], s, a);
}
song_node * find_song(char s[]) {
int i=0;
song_node *tmp = 0;
while(!tmp && i++ < 2... |
C | // author: Karol Baraniecki
#include <stdio.h>
static int month_lengths[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main() {
int month, weekday;
scanf("%d %d", &month, &weekday);
printf("Miesiac %d\n", month);
puts("|Ni|Po|Wt|Sr|Cz|Pt|So|");
for(int i = 0; i < weekday; i++) {
... |
C | #include <stdio.h>
int joseph(int n, int m);
int joseph2(int n, int m,int r);
int main(void)
{
int n=6,m=4;
int position=joseph(n,m);
printf("%d ",position);
joseph2(n,m,2);
return 0;
}
//nųһȦ1ʼm˳У1ֱʣһˣš
int joseph( int n, int m ) {
int idx = 0;
int x;
for(x = 2; x <= n; ++x )
... |
C | #include<stdio.h>
void main() {
// 1. printf always print
// first argument
// 2. to print other args
// use format specifier
// %d %f %c
//3. first arg must be string
//4. if matching arg doesnt exist then printf GV
// printf("%d %d %d");
// printf(a);
// printf("%... |
C | /*
* File: flash.h
* Author: Luke
*
* Created on 8. Januar 2017, 17:13
*/
#ifndef FLASH_H
#define FLASH_H
#define FLASH_PAGE_SIZE 512
//True value is 4096. We have to cheat a bit so windows accepts it as a FAT16, not FAT12
#define FLASH_NUMBER_OF_PAGES 4114
typedef enum
{
FLASH_POWER_STATE_NORMAL,
... |
C | // just a simple program to be executed from inside the child proc
#include <stdio.h>
int main(void)
{
char name[20];
printf("\tEnter your name:");
scanf("%19s", name);
printf("\tHello %s !\n", name);
return 0;
}
// gcc -Wall -o 14.2example14.4newprog.exe 14.2example14.4newprog.c
|
C | //Matei Razvan-Madalin
//313CA
#include<stdio.h>
//Definesc functia max ce returneaza valoarea maxima dintre 3 numere
int max(int a, int b, int c) {
int maxim;
if(a>b) maxim=a;
else maxim =b;
if(c>maxim) maxim=c;
return maxim; }
//Definesc functia min ce returneaza valoarea minima dintre 3 numere
int min(int a,... |
C | #include <stdio.h>
/*prints the sum of all the multiples of 3 or 5 below 1024 (excluded),
followed by a new line.*/
int main(void)
{
int n, sum;
sum = 0;
for (n=1; n<1024; n++)
{
if ((n%3==0) || (n%5==0))
{
sum += n;
}
}
printf("%d\n", sum);
return(0);
}
|
C | #include <immintrin.h>
#define ALIGN(x) x __attribute__((aligned(32)))
// both elements = dot(x,y)
void DP(double* vec1, double* vec2, double* result) {
__m256d x = _mm256_load_pd(vec1);
__m256d y = _mm256_load_pd(vec2);
__m256d xy = _mm256_mul_pd(x, y);
__m128d xylow = _mm256_castpd256_pd128(xy); ... |
C | //Daniel Rico
//October 9, 2015
//CSCE 155E
//Assignment #3, Part 5
//This program will compute back and forth between four energy scales (calories, joules, ergs, foot pounds force).
#include<stdio.h> //preprocessing directives standard input output library
#include"energy.h" //linked file to header sections (modula... |
C | #include<stdio.h>
#include<time.h>
#include<stdlib.h>
#define MAX 500000
#define MAX_NUM 5000000
void GenerateDataAndInsert(int *array, int size){
// generate random data and insert into array
int i = 0;
rand();
for(i = 0; i < size; i++){
int num = rand() % MAX_NUM;
array[i] = num;
}
}
int SearchA... |
C | /*
This program will numerically compute the integral of
4/(1+x*x)
from 0 to 1. The value of this integral is pi -- which
is great since it gives us an easy way to check the answer.
The is the original sequential program. It uses the timer
from the OpenMP runtime library
His... |
C | /** @file
Math worker functions.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "BaseLibInternals.h"
/**
Returns the bit position of the lowest bit set in a 32-bit value.
This function computes the bit po... |
C | // gcc shower.c -lglut -lGL -lGLU -lm
#include <unistd.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
#define MAX_GOTAS 1500
#define PI 3.1415
// Rotation amounts
static GLfloat xRot = 0.0f;
static GLfloat yRot = 0.0f;
float radius = 1.0f;
float angle = 0.0f;
typed... |
C | #include <stdio.h>
int gv = 5;
int __attribute__((annotate("sensitive"))) gv_s = 2017;
float __attribute__((annotate("sensitive"))) pi = 3.14;
int __attribute__((annotate("sensitive"))) *gtest_1;
//int __attribute__((annotate("sensitive"))) gtest_2 = 2015;
//int __attribute__((annotate("sensitive"))) gtest_3 = 2... |
C |
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
int mkdir(const char *pathname, mode_t mode);
int main(int argc, char * argv[])
{
int a;
mode_t mode;
mode = (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
// crea una cartella nel percorso passato come parametro
if(a... |
C | #include <avr/io.h>
#include <util/delay.h>
#include "distanceSensor.h"
int distance;
long time;
void distanceSensor_init() {
DDRB |= (1 << 0); //make the trigger in the distance sensor as output
DDRB &= ~(1 << 1);//make the echo in the distance sensor as input
PORTB &= ~((1 << 0) | (1 << 1)); //dont activate th... |
C | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
//Josh Post, CSC 344 Assignment 1
//Due Friday, September 23rd
//API for permutations.
//Input any String and it will recursively display
//all permutations of that String
void permutation(char *string, int x, int length);
voi... |
C | /**
* Growable Buffer
*
* by William R. Fraser, 10/19/2011
*/
#ifndef GROWBUF_H
#define GROWBUF_H
typedef struct _growbuf
{
void* buf;
size_t allocated_size;
size_t size;
} growbuf;
growbuf* growbuf_create(size_t initial_size);
void growbuf_free(growbuf* gb);
int growbuf_append(growbuf* gb,... |
C | /*
** split_cmd.c for minishell2 in /home/thibaut/Repository/PSU_2016_minishell2
**
** Made by Thibaut Trouvé
** Login <thibaut.trouve@epitech.eu>
**
** Started on Wed May 3 03:46:06 2017 Thibaut Trouvé
** Last update Wed May 3 06:13:28 2017 Thibaut Trouvé
*/
#include <stdlib.h>
#include "main.h"
#include "my.h... |
C | #define SIZE 150
int inp_arr[SIZE];
int Rear = - 1;
int Front = - 1;
void enqueue(int insert_item){
if (Rear == SIZE - 1)
printf("Overflow \n");
else{
if (Front == - 1)
Front = 0;
printf("Element to be inserted in the Queue\n : ");
Rear = Rear + 1;
inp_arr[Re... |
C | #include <string.h>
int main(int argc, char *argv[])
{
char raw_input[110];
int clients = 0,traffic = 0, data_length = 0,i,name_length;
while(gets(raw_input))
{
if(raw_input[0] == '+')
clients++;
else if(raw_input[0] == '-')
clients--;
else {
i = 0;
name_length = 0;
data_length = 0;
whil... |
C | #ifndef EMPLEADO_H_INCLUDED
#define EMPLEADO_H_INCLUDED
struct S_Empleado
{
int id;
char nombre[128];
char apellido[128];
char isEmpty[128];
int sueldo;
};
typedef struct S_Empleado Empleado;
Empleado* Empleado_new();
int Empleado_delete();
Empleado* Empleado_newConParametros(char* id,char* nombre,char* ap... |
C | /*
** command.c for 42sh in /home/jeremy/Delivery/PSU_2016_42sh/src
**
** Made by Jérémy Sid Idris
** Login <jeremy.sid-idris@epitech.eu>
**
** Started on Wed Apr 5 21:48:10 2017 Jérémy Sid Idris
** Last update Wed Apr 5 21:48:10 2017 Jérémy Sid Idris
*/
#include <stdio.h>
#include <stdlib.h>
#include "helpers/... |
C | /*
You are given an array of positive integers beans, where each integer represents the number of magic beans found in a particular magic bag.
Remove any number of beans (possibly none) from each bag such that the number of beans in each remaining non-empty bag (still containing at least one bean) is equal. Once a be... |
C | #ifndef GZOS_TIME_H
#define GZOS_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/time.h>
static inline time_t time_sec_to_ms(time_t sec) {
return sec * 1000;
}
static inline time_t time_usec_to_ms(useconds_t usec) {
return usec / 1000;
}
static inline time_t time_timeval_to_ms(struct timeval* ti... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char buffer[100],x;
FILE *fp;
fp=fopen("filetest4.txt","a");
if(!fp)
exit(1);
printf("file is open, you can start writing press '~' to save and exit\n");
scanf("%[^'~']s",buffer);
//strcat(buffer,"\n");
fputs(buffer,fp);
fputc('\n',fp);
... |
C | /*_________________________________________________________________*/
/* Autor Dali Lopez Martinez */
/* E-mail : DaliLopez-MartinezT@hotmail.com */
/* Fecha de Creacion : 15/05/2018 */
/* Fecha de Actualizacion : 15/05/2018 ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int* quickSort(int* array, int length){
int update = 1;
int nPicks = 0;
while(update == 1 || nPicks < length){
update = 0;
nPicks++;
int pivotIndex = rand() % (length -1);
int pivot = array[pivotIndex];
for(int i = 0; i < leng... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
bool T(char*,char**);
bool T1(char*,char**);
bool E(char*,char**);
bool E1(char*,char**);
bool F(char*,char**);
bool E(char *str, char **lookahead) {
printf("INSIDE E\n");
return T(str, lookahead)&&E1(str, lookahead);
}
bool T(char *s... |
C | #include <wiringPi.h>
#include <wiringShift.h>
#include "tm1638.h"
// just like strlen except periods don't count
uint8_t tmstrlen(char s[]) {
uint8_t result;
char c, *p;
result = 0;
p = s;
while ((c = *p++) != '\0')
if (c != '.')
result++;
return result;
}
void sendData(uint8_t value) {
shiftOut(DATA,... |
C | /**
* ANSI
*
* Ansi color codes and escape codes
*/
#ifndef _ANSI_H
#define _ANSI_H
// Color codes
#define CBLACK "30"
#define CRED "31"
#define CGREEN "32"
#define CYELLOW "33"
#define CBLUE "34"
#define CMAGENTA "35"
#define CCYAN "36"
#define CWHITE "37"
#define CRST "0"
// Escape ANSI ch... |
C | #ifndef _EVENT_TIMER_H_INCLUDED_
#define _EVENT_TIMER_H_INCLUDED_
#include "core.h"
#include "event.h"
#define TIMER_INFINITE (uint32_t) -1
#define TIMER_LAZY_DELAY 300
int event_timer_init(void);
uint32_t event_fine_timer(void);
void event_expire_timers(void);
void event_cancel_timers(void);
extern rbtree_... |
C | #include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/printk.h>
#include <linux/types.h>
#include <linux/ktime.h>
#include <linux/slab.h>
struct head_list {
struct head_list *item_next;
ktime_t time;
};
MODULE_AUTHOR("Hana Khalil <hanka100h@gmail.com>");
MODULE_DESCRIPTION... |
C | #include "mesh.h"
#include <string.h>
struct gf_Mesh init_mesh() {
struct gf_Mesh result = ZERO_STRUCT;
glGenBuffers(1, &result.vertsBuffer);
glGenBuffers(1, &result.trisBuffer);
return result;
}
void updateBuffer(Data info, u32 buffer);
void prepare_mesh(struct gf_Mesh mesh) {
u32 stride = 3*... |
C | #include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
void rotate(char matrix[10][10]){
char dup[10][10];
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
dup[i][j]=matrix[i][j];
}
}
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
matrix[i][j]=dup[9-j][i];
}
}
}
int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.