Advertisement
idsystems

Cpp_Practica 22 - Reversadora Numeros

Jan 26th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. // Program: reversadora.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.    int n, d1, d2, d3, d4, d5, a1=10000, a2=1000, a3=100, a4=10;
  12.  
  13.    cout << "Maquina reversadora de numeros" << endl;
  14.    cout << "==============================" << endl;
  15.  
  16.    cout << "Ingrese un numero de cinco digitos = "; cin >> n;
  17.  
  18.    cout << endl;
  19.    cout << "su numero en forma normal es " << n << endl;
  20.  
  21.    d1 = n / a1; n -= d1 * a1;
  22.    d2 = n / a2; n -= d2 * a2;
  23.    d3 = n / a3; n -= d3 * a3;
  24.    d4 = n / a4; n -= d4 * a4;
  25.    d5 = n;
  26.  
  27.    cout << "su numero al reves es " << d5 << d4 << d3 << d2 << d1 << endl;
  28.  
  29.    return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement