Concetti Chiave
- The method processes a square matrix to extract specific elements.
- It targets even numbers located in even rows below the main diagonal.
- Only elements in the lower triangular part of the matrix are considered.
- The resulting elements are stored in an array for further use.
- Implementation involves iterating over even-indexed rows starting from the second row.
Tema 75
Scrivere un metodo stampaElementiPariRighePariSottoDiagonale che riceve in ingresso una matrice quadrata M e crea un array con gli elementi pari appartenenti alle righe pari posti nel triangolo inferiore al di sotto della diagonale principale.
Sia M la matrice cos costituita
3 | 18 | 15 | 7 | 2 |
1 | 9 | 11 | 4 | 6 |
7 | 2 | 6 | 3 | 5 |
5 | 1 | 25 | 2 | 1 |
3 | 2 | 33 | 4 | 4 |
2 | 2 | 4 |
public class tema75{ public static void stampaElementiPariRighePariSottoDiagonale (int[][] M){ // scorriamo le righe partendo dalla seconda ed effettuando salti di due per // raggiungere solo le righe pari for (int i = 2; i