[ create a new paste ] login | about

Link: http://codepad.org/bb60hoht    [ raw code | output | fork ]

C, pasted on Sep 26:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<stdio.h>
#include<stdlib.h>

int main(void) {
	char line[64] = {0};
	int sum = 0;
	
	while (fgets(line, 64, stdin)) {
		sum += atoi(line);
	}
	
	printf("sum is\t%d\n", sum);
	
	return EXIT_SUCCESS;
}


Output:
1
sum is	0


Create a new paste based on this one


Comments: