me apoye de esto: http://www.programiz.com/cpp-programming/examples/sum-natural-number
Tag: #WSQ07
#WSQ07
#include <iostream>
using namespace std;
int main(){
int n1,n2, s=0;
cout << “Dame el primer numero del rango: ” << endl;
cin >> n1;
cout << “Dame el segundo numero del rango: ” << endl;
cin>> n2;
for(int c=n1; c<=n2; c++){
s=s+c;
}
cout << “La suma de los numeros desde ” << n1 << ” hasta ” << n2 << ” = “<< s << endl;
return 0;
}
WSQ07 Sum of numbers
In this program we can sum the numbers between the ones you say.
For example, I you say the first number is 6 and the second 10, the sum will be 40.
So this is the code I wrote on XCode:
Also the code will be here in this link on GitHub.
TC101
WSQ07