natural numbers upto the range entered by user*/
#include <iostream>
using namespace std;
int main()
{
int sumStore=0,i,Srange,Erange;
cout<<"Enter start range ";
cin>>Srange;
cout<<"Enter End range ";
cin>>Erange;
for(i=Srange;i<=Erange;i++)
{
sumStore=sumStore+i;
}
cout<<"\nSum of Natural numbers from "<<Srange<<" to "<<Erange<<" is= "<<sumStore;
cout<<endl;
return 0;
}
No comments:
Post a Comment