Home | History | Annotate | Download | only in mongo
      1 /*
      2  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
      3  */
      4 
      5 #include <stdio.h>
      6 #include <stdlib.h>
      7 char str[100];
      8 
      9 int main(int argc, char **argv)
     10 {
     11 	char c, *p;
     12 	int sum = 0, n = 0;
     13 
     14 	p = str;
     15 	while ((c = getchar()) != EOF) {
     16 		if (c != '\n') {
     17 			*p++ = c;
     18 		} else {
     19 			*p = '\0';
     20 			n = atol(str);
     21 			sum += n;
     22 			printf("%i\n", sum);
     23 			p = str;
     24 			*p = '\0';
     25 		}
     26 	}
     27 }
     28