0
How display diagonal of 2d array.. assume it is 3×3
2 Réponses
+ 5
size=3
//Left to right diagonal
for(x=0;x<size;x++){
cout>>arr[x][x]
}
//Right to left diagonal
for(x=0;x<size;x++){
cout>>arr[size-x-1][x]
}
0
Use a for loop to loop 3 indexes then access array[i][i]
This will go diagonally through