Created
February 3, 2016 18:46
-
-
Save batmantec/bcec98aea205edcb679c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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