Advertisement
tonygms3

Question 5

Dec 19th, 2017
83
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.  
  5.  
  6.     int input,i,sum;
  7.     printf("Enter number \n");
  8.     scanf("%d",&input);
  9.     sum=0;
  10.     for(i=input;i>=0;i--)
  11.     {
  12.         sum=sum+i;
  13.  
  14.     }
  15.  
  16.      printf("%d\n",sum);
  17.  
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement