+ 1
Crear un algoritmo(diagrama de flujo y pseudocodigo)de un programa que muestre en pantalla los primeros 100 números impares
Aquí se usa el pseudocodigo, y debemos declarar las variables . Ayúdame a Resolverlo
2 odpowiedzi
+ 2
Thanks
+ 1
1. Declare a variable named a (or any other valid name) and give it a value of 1
Like this,
int a = 1;
2. Create a for loop that runs 100 times
Like this,
for (int i = 0; i < 100; i++) {}
(Might be different in different languages)
3. Inside the loop print a
Like this,
cout << a;
4. And since all odd numbers have a gap of 2, you will have to increase a by 2 each time
Like this,
a+=2;
The code should like this:
int a = 1;
for (int i = 0; i < 100; i++) {
cout << a;
a+=2;
}