home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch2 / epp4.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  325b  |  12 lines

  1. /*            epp4.c                 */
  2. #include <stdio.h>
  3. int main( void )
  4.                 {
  5. int y,x = 0;
  6. printf("Enter your integers now.\n");
  7. printf("Enter one integer per line, press return.\n");
  8. printf(">>> ");
  9. while((scanf("%d",&y))!=EOF){
  10. x=x+y; printf(">>> "); }printf("\nThe sum is %d.\n", x);
  11. return 0;}
  12.