/
advo_kitty
/
28.11.2025_Task8_light
Обзор
Документация
Войти
/
advo_kitty
/
28.11.2025_Task8_light
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Main.java
42 строки
1 KB
advo_kitty
upload files
28 ноя 2025, 14:31
28 ноя 2025, 14:31
e63c1f3
Код
Авторство
О чём код?
import java.util.Scanner; import java.util.Random; public class Main { public static final int SIZE = 8; public static void main(String[] args) { int[][] colors = { {114, 112, 148, 83, 204, 22, 125, 31}, {192, 231, 245, 128, 63, 246, 139, 17}, { 61, 128, 224, 45, 91, 57, 239, 34}, {219, 237, 167, 191, 236, 146, 144, 117}, { 35, 199, 102, 124, 208, 195, 21, 147}, { 52, 229, 126, 32, 24, 145, 19, 39}, {107, 43, 190, 43, 47, 172, 18, 19}, { 62, 221, 6, 208, 241, 198, 187, 85} }; System.out.println("Исходная матрица:"); printMatrix(colors); int[][] rotatedColors = new int[SIZE][SIZE]; 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.printf("%4d ", matrix[i][j]); } System.out.println(); } } }