Skip to content

Instantly share code, notes, and snippets.

@batmantec
Created February 3, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batmantec/bcec98aea205edcb679c to your computer and use it in GitHub Desktop.
Save batmantec/bcec98aea205edcb679c to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main (){
int low, up, sum=1, olow;
cout<<"This program calculates the sum of 2 integer numbers that you give"<<endl;
cout<<"Please, give me lower number: ";
cin>>low;
olow=low;
cout<<"Please give me upper number: ";
cin>>up;
if (low<=up){
do {
low++;
sum=sum+low;
} while(low!=up);
cout<<"The sum of "<<olow<<" and "<<up<<" numbers is "<<sum<<endl;}
else{
cout<<"The number that you typed was upper than the upper number";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment