Advertisement
Sabbir-bin

sum for sequence

Dec 6th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int n, sum;
  5.   printf("\tsum for 1 to 100\n");
  6.   printf("\t----------------");
  7.  
  8.   scanf("%d",&n);
  9.  
  10.  
  11.   sum=(n*(n+1))/2;
  12.  
  13.   printf("\nThis is the result:-%d",sum);
  14.  
  15. printf("\n\n");
  16.   return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement