Está en la página 1de 1

1 #include <iostream>

2
3 using namespace std;
4
5 int main()
6 {
7 cout << "Hello world!" << endl;
8 int suma;
9 int numero;
10 int x;
11 int cant;
12
13 cout<<" ingresa el valor inicial de suma "<<endl;
14 cin>>suma,
15 cout<<"ingrese cantidad de suemandos "<<endl;
16 cin>>cant;
17 for(x=1;x<=cant;x=x+1)
18 {//x=+1 equivalente a;x+1 contador
19 cout<<"ingrese el numero "<<x<<":";//acumulador cuando tiene figurando de los dos lados de la variable
el signo =
20 cin>>numero;
21 suma=suma+numero;
22 }
23 cout <<"el total es; "<<suma<<endl;
24 return 0;
25 }

También podría gustarte