Advertisement
Aminpro

[ECP 1016]Tutorial 4 number 7 (while loop)

Jul 1st, 2012
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. //https://www.facebook.com/AminproPastebin
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(void)
  6. {
  7.     int counter= 0; int sum=0;
  8.    
  9.     while(counter <= 50){
  10.                  
  11.                  sum = sum + counter ;
  12.                  counter ++;
  13.                  
  14.                   }
  15.         printf("Sum of 1 to 50 is %d", sum);
  16. getchar();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement