Advertisement
MouseyN1

Concatenare matrice

May 7th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i, j, m, n, a[100][100];
  6.     cout << "Introduceti numarul de linii: ";
  7.     cin >> m;
  8.     cout << "Introduceti numarul de coloane: ";
  9.     cin >> n;
  10.     for(i = 1; i <= m; i++)
  11.         for(j = 1; j <= n; j++)
  12.         {
  13.             if(i > j)
  14.                 a[i][j] = i * 10 + j;
  15.             else a[i][j] = j * 10 + i;
  16.         }
  17.     for(i = 1; i <= m; i++) {
  18.         for(j = 1; j <= n; j++)
  19.             cout << a[i][j] << " ";
  20.         cout << endl;
  21.     }
  22.     cout << endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement