WSQ07 – Sum of Numbers

el código:

#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main()
{
int num1,num2,rest,resul,x;
resul=0;
cout<<“nWe will calculate the sum of integers in the range you provide.”;
cout<<“nPlease give us the lower bound: “;
cin>>num1;
cout<<“nPlease give us the upper bound: “;
cin>>num2;
rest=num2-num1;
for(x=0; x<=rest; x++)
{
resul=resul+num1;
num1++;
}
cout <<“nEl resultado es “<<resul;
getchar();
return 0;

CC BY-SA 4.0 WSQ07 – Sum of Numbers by perape is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.