Advertisement
Fahim_789

Loop7(1 to n)Even Sum

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