online tutorials store
Write a program to calculate the sum of all the numbers from 1 to 50 using for loop.
#include<stdio.h>
main()
{
int i,sum=0;
for(i=1;i<=50;i++)
{
sum=sum+i;
}
printf("\nSum of all the number from 1 to 50=%d",sum);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment