Untitled

 avatar
unknown
plain_text
4 years ago
512 B
5
Indexable
//24.Dados dos números enteros A y B mostrar la lista de los números impares comprendidos entre ellos.
#include <iostream>
using namespace std;
int main()
{
    int aux, i, a, b;
    cout << "Ingrese A: ";
    cin >> a;
    cout << "Ingrese B: ";
    cin >> b;
    if (a < b)
    {
        aux = a;
        a = b;
        b = aux;
    }
    i = b;
    while (i <= a)
    {
        if (i % 2 == 1)
        {
            cout << i << endl;
        }
        i++;
    }
    return 0;
}
Editor is loading...