Searching...

Sum of Integers up to Given point.

15:40

#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;
}

0 comments:

Post a Comment

Thanks For Your FeedBack....