# Subiectul 3 -> Prb 2

Apr 7th, 2021
383
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include    <iostream>
2.
3. using namespace std;
4.
5. int main()
6. {
7.     int mat[101][101];
8.     unsigned int n;
9.     cin >> n;
10.
11.     for(int i = 0; i < n; i++)
12.         for(int j = 0; j < n; j++)
13.             cin >> mat[i][j];
14.
15. // for prima coloana -> 1 2 3 4 5
16. // for ultima linie (dar fara prima cifra) -> 6 7 8 9
17. // for ultima coloana (dar fara ultima cifra) -> 0 2 4 6
18. // for prima linie (dar fara primu + ultimu elem) -> 8 1 3
19.
20.     for(int i = 0; i < n; i++) // prima coloana
21.         cout << mat[i][0] << " ";
22.
23.     for(int j = 1; j < n; j++) // ultima linie
24.         cout << mat[n - 1][j] << " ";
25.
26.     for(int i = n - 2; i >= 0; i--) // ultima coloana
27.         cout << mat[i][n - 1] << " ";
28.
29.     for(int j = n - 2; j >= 1; j--) // prima linie
30.         cout << mat[0][j] << " ";
31.
32.     return 0;
33. }
RAW Paste Data