Advertisement
fahim-ahmed2019

sum of 1-100 numbers by using while loop#include <stdio.h> i

Oct 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int n=100;
  5. int sum=0;
  6. int i=1;
  7. while (i<=n )
  8. {
  9. printf("%d\n",i);
  10. sum += i;
  11. i++;
  12. printf("Sum=%d\n",sum);
  13. }
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement