#WSQ07<\/a><\/p>\n In this assignment we had to use a loop to sum a number that the user chooses with every number in the middle of it and another maller number that the user chooses too. In order to do what mentioned, I would switch the part of the algorithm in charge of it.( the signs and mathematic algorithms)<\/p>\n Here’s my code:<\/p>\n https:\/ <\/p>\n or here too:<\/p>\n #include<\/a> <iostream> do{ if (x<y){ else { #WSQ07In this assignment we had to use a loop to sum a number that the user chooses with every number in the middle of it and another maller number that the user chooses too. In order to do what mentioned, I would switch the part of the algori… Continue reading
using namespace std;
int main (){
int x, y, z, ch, res, su;<\/p>\n
cout << “Introduce el número más chico.” << endl;
cin >> x;
cout << “introduce el número mayor.” << endl;
cin >> y;<\/p>\n
ch=0;
}<\/p>\n
cout << endl <<“escribiste los números de manera incorrecta, intenta de nuevo.” << endl;
ch=10;
}
} while (ch==10);
if(ch==0)
z=(y-x)+1;
su=0;
for (int i=0; i<z; i++){
res=(x+i);
su=su+res;
}
cout << “La suma de ” << x << ” hasta ” << y <<” es equivalente a ” << su;
return 0;
}<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"