Write a program that calculate the sum of all the number that is entered by user
///////// solutions
#include <iostream>
using namespace std;
int main() {
int sum,n;
cout<<"Enter the number plase "<<endl;
cin>>n;
sum=(n*(n+1))/2;
cout<<"The sum is "<<sum<<endl;
}
No comments:
Post a Comment