donmike25

ecp1016 tutorial 4(6while)

Jun 30th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int counter= 0; int sum=0;
  6.    
  7.     while(counter <= 50){
  8.                  
  9.                  sum = sum + counter ;
  10.                  counter ++;
  11.                  
  12. }
  13.         printf("Sum of 1 to 50 is %d", sum);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment