Adding some strings and geometry algorithms to notebook.
[andmenj-acm.git] / PC^2 / pc2board / samps / isumit.c
blob8a25b708e8d5d18c86757dc2d1f1329e14b6ffe7
2 /*
3 * File: isumit.c
4 * Purpose: to sum the integers from stdin
5 * Author: pc2@ecs.csus.edu or http://www.ecs.csus.edu/pc2
7 * Thu Oct 2 20:27:08 PDT 2003
9 * $Id: isumit.c,v 1.1 2005/03/06 05:34:39 laned Exp $
13 #include <stdio.h>
15 #define INFILENAME "sumit.dat"
17 main ()
19 int sum = 0;
20 int i;
22 while (1==fscanf(stdin, "%d", &i))
24 sum += i > 0 ? i : 0;
26 printf("The sum of the positive integers is %d \n",sum);
30 /* eof isumit.c $Id: isumit.c,v 1.1 2005/03/06 05:34:39 laned Exp $ */