Untitled
unknown
plain_text
4 years ago
491 B
3
Indexable
//22 Mostrar los números del 1 al 100 en forma descendente pero solo impares, diseñar el algoritmo tanto con la estructura while como la for.
#include <iostream>
using namespace std;
int main()
{
int i = 100;
while (i >= 0)
{
if (i % 2 == 1)
{
cout << i << endl;
}
i--;
}
for (i = 100; i >= 0; i--)
{
if (i % 2 == 1)
{
cout << i << endl;
}
}
return 0;
}
Editor is loading...