Advertisement
rihardmarius

Multiplicacion de clases en Zn

Sep 7th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cout << "Ingrese n: ";
  9.     cin >> n;
  10.     cout << "\nMultiplicacion de clases en Z" << n << "\n";
  11.     cout << "\n  * |  ";
  12.     for (int i=0; i<n; i++)
  13.     {
  14.         cout << i << ' ';
  15.         if (i<9)
  16.             cout << ' ';
  17.     }
  18.  
  19.     cout << "\n----+-";
  20.     for (int i=0; i<n; i++)
  21.         cout << "---";
  22.     cout << endl;
  23.     for (int i=0; i<n; i++)
  24.     {
  25.         if (i<10)
  26.             cout << ' ';
  27.         cout << ' ' << i << " | ";
  28.         for (int j=0; j<n; j++)
  29.         {
  30.             if ((i*j)%n<10)
  31.                 cout << ' ';
  32.             cout << (i*j)%n << ' ';
  33.         }
  34.  
  35.         cout << endl;
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement