Skip to content

Instantly share code, notes, and snippets.

@jesuscmadrigal
Created September 1, 2017 17:13
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 jesuscmadrigal/ae8e994c569cb2ab2c9104dec8b07acd to your computer and use it in GitHub Desktop.
Save jesuscmadrigal/ae8e994c569cb2ab2c9104dec8b07acd to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main ()
{ int sum,min,max,n;
sum=0;
cout << "We´re going to sum up numbers between numbers!!" << endl;
cout << "Now pick the first integer that you want to initialized: " << endl;
cin >> min;
n=min;
cout << "Then the second integer please: " << endl;
cin >> max;
while (n <= max)
{
sum=sum+n;
n=n+1;
}
cout << "the sum from " << min << " to " << max << " is: " << sum << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment