Programming In C
Improve your Programming Skills with almost every C Program.
Home
Blog Posts
Life Style
Relationship
Make Money
Follow Us
Facebook
Twitter
About Us
Who We Are?
Contact Us
Tuesday, February 9, 2010
Write a C program to compute the sum of the terms 1+2+3+.....upto N terms
#include< stdio.h>
#include< conio.h>
int main()
{
int n,i,sum=0;
clrscr();
printf("Enter the 'n' value:");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
sum=sum+i;
}
printf("\nSum of the 'n' terms: %d",sum);
getch();
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment