Advertisement
RAJIBRAJU

sum of natural numbers

May 26th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. #include<stdio.h>
  2. int main ()
  3. {
  4.     int i,sum=0,n;
  5.     printf("enter any number :");
  6.     scanf("%d",&n);
  7.     for (i=1;i<=n;++i)
  8.     { sum+=i;}
  9.         printf("%d\n",sum);
  10.  
  11.     return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement