Version:0.9 StartHTML:0000000105 EndHTML:0000002057 StartFragment:0000000152 EndFragment:0000002023
/******************************************************/
/*************** Isidro Pastor Jorda ******************/
/******************************************************/
/****************** Telematica ************************/
/******************************************************/

#include <iostream.h>
#include <stdlib.h>

int Invertir (int  dato, int  & resto);

int main()
{
    int resultado, x, resto;

    resultado = 0;
    cout << endl << " Introduce el numero a invertir -> ";
    cin >> x;
    resto=0;
    resultado = Invertir(x, resto);

    cout << endl << " El numero invertido es -> " << resultado;
    cout << endl << endl;

    system("PAUSE");

    return 0;
}


int Invertir (int dato, int & resto)
{
   int cociente, resto_local;


   if (dato !=0)
   {
       cociente = dato / 10;
       resto_local = dato % 10;
       resto = resto * 10 + resto_local;
       Invertir(cociente, resto);
   }

   return resto;
}