Sunday, September 4, 2011

c programs


Q.sum all the odd numbers from 1 to 10
 
Ans.
main()
{
int i,sum=0;
for(i=1;i<=10;i+=2)
sum=sum+i;
printf(“sum=%d”,sum);
getch();
}

No comments:

Post a Comment