• Lenguaje

    C++

  • Descripción

    Solicita el ingreso de un número de tres cifras, y que muestra el mismo número con las cifras invertidas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifdef __MSDOS__
    #include <iostream.h>
    #include <stdlib.h>
#else
    #include <iostream>
    #include <cstdlib>
    using namespace std;
#endif

int main (void)
{
    int invertido, numero;
    cout << "Ingresa el valor de numero: ";
    cin >> numero;
    cin.get();
    invertido=(numero%100000-numero%10000)/10000+(numero%10000-numero%1000)/100+(numero%1000-numero%100)+(numero%100-numero%10)*100+(numero%10)*10000;
    cout << "Valor de invertido: " << invertido << endl;
    cout << endl;
    system ("pause");
    return EXIT_SUCCESS;
}