for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { mas[i][j]; // главная диагональ mas[i][2-j]; // побочная }}