SHARE
TWEET

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

fahim-ahmed2019 Oct 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top