|
|
|
|
|
| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 18 Feb 2008 13:19:26 IST
|
|
|
/*Program to print the series 1+2+3.....n*/ #include<iostream.h> #include<conio.h> void main() { int n; long int sum=0; cout<<"1+2+3.....n\n"; cout<<"Enter the value till which you want to calculate the sum of" <<"of the series(n)\n"; cin>>n; for(int i=0;i<=n;++i) { sum=sum+i; } cout<<"The sum the the series is "<<sum; getch(); }
|
Be not afraid of growing slowly.
Be afraid only of standing still.
|
this reply: 5 points
(with 1 
in 1 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
|
|
|
|
|
|
|