Saturday, 27 July 2013

C-Program To Find The SUM Of ODD Numbers Upto a Limit

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



sakoncepts.blogspot.com
output

No comments:

Post a Comment