Saturday, 27 July 2013

C-Program To Find The SUM of EVEN Numbers Upto a Limit

#include<stdio.h>
main ()
{
int sum=0,n,i;
printf("Enter the Limit\t");
scanf("%d",&n);
for(i=0;i<=n;i=i+2)
{
if(i%2==0)
{
sum=sum+i;
}
}
printf("Sum of Even Numbers Upto %d is %d",n,sum);
}


sakoncepts.blogspot.com
output


No comments:

Post a Comment