Created
February 16, 2016 11:14
-
-
Save alonzoibarra97/cb40a5ecea0a61c9f1d3 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 n1, n2; | |
cout << "We will calculate the sum of integers in the range you provide.\n"; | |
cout<< "Please give us the lower bound: \n"; | |
cin>> n1; | |
cout<< "Please give us the upper bound: \n"; | |
cin>> n2; | |
int c= n1; | |
int sum=0; | |
do{ | |
sum=sum+c; | |
c=c+1; | |
}while(c<=n2); | |
cout << "The sum from " << n1 << " to " << n2 << "is " << sum; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment