#include<iostream.h> #include<conio.

h> main() { int i,n,sum; cout<<"\n Enter the value of n :"<<endl; cin>>n; sum=0; for(i=1;i<=n;i++) sum=sum+i; cout<<"sum="<<sum; getch(); }

Sign up to vote on this title
UsefulNot useful