Advertisement
roneygomes

Bits Trocados

Mar 16th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int x = 0, V, I, J, K, L;
  7.    
  8.     cin >> V;
  9.    
  10.     while(V != 0)
  11.     {
  12.         if(V < 50)
  13.         {
  14.             I = 0;
  15.             goto dez;
  16.         }
  17.        
  18.         I = (V - (V%50)) / 50;
  19.         V = V%50;
  20.        
  21.         dez:
  22.         if(V < 10)
  23.         {
  24.             J = 0;
  25.             goto cinco;
  26.         }
  27.        
  28.         J = (V - (V%10)) / 10;
  29.         V = V%10;
  30.        
  31.         cinco:
  32.         if((V%10) < 5)
  33.         {
  34.             K = 0;
  35.             goto um;
  36.         }
  37.            
  38.         K = (V - (V%5)) / 5;
  39.         V = V%5;
  40.        
  41.         um:
  42.         L = V;
  43.        
  44.         x++;
  45.        
  46.         cout << "Teste" << x << "\n";
  47.         cout << I << " "<< J << " " << K << " " <<  L << "\n";
  48.         cout << endl;
  49.        
  50.         cin >> V;
  51.     }
  52.    
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement