Friday 16 November 2012

Sum of Integers up to Given point.


#include <iostream>
using namespace std;
int main()
{
int sum=0,end_num;
cout << "Enter integer for which u want to get Sum: ";
cin >> end_num;
for (int i=1;i<=end_num;i++)
sum=sum+i;
cout << "Integer Sum of 1 to "<< end_num << " is= " << sum <<endl;
return 0;
}

No comments:

Post a Comment