/
marina14
/
z6
Обзор
Документация
Войти
/
marina14
/
z6
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Main.java
40 строк
1 KB
marina14
upload files
26 фев 2026, 19:52
Верифицирован
26 фев 2026, 19:52
7828424
Код
Авторство
О чём код?
import java.util.Random; public class Main { public static final int SIZE = 8; public static void main(String[] args) { int[][] colors = new int[SIZE][SIZE]; Random random = new Random(); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { colors[i][j] = random.nextInt(256); } } System.out.println("Исходная матрица:"); printMatrix(colors); int[][] rotatedColors = new int[SIZE][SIZE]; // Поворачиваем на 90° по часовой стрелке for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { rotatedColors[j][SIZE - 1 - i] = colors[i][j]; } } System.out.println("\nМатрица после поворота на 90° по часовой стрелке:"); printMatrix(rotatedColors); } public static void printMatrix(int[][] matrix) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { System.out.format("%4d", matrix[i][j]); } System.out.println(); } } }