👤

Se citește o matrice si se cere sa se afișeze penultima linie,iar dedesubt primul si ultimul element din matrice.
Exemplu: n=2 m=6
1 2 3 4 5 6
+ 8 9 7 8 9
1 2 3 4 5 6
a[1][1] | a[n][m]
1 9
Va rog frumos ajutati-ma!!​


Răspuns :

Răspuns:

#include <iostream>

using namespace std;

int m = 6;

int n = 2;

int matrix[n][m] = {{1,2,3,4,5,6},{2,8,9,7,8,9}};

int main()

{

   for(int i = 0; i < m; i++){

       cout << to_string(matrix[n-2][i]) + " ";

   }

   cout << endl;

   cout << to_string(matrix[0][0]) + " ";

   cout << to_string(matrix[n-1][m-1]);

   return 0;

}

Sper ca e de folos!