/
akupan2012
/
mnogomernmasiv
Обзор
Документация
Войти
/
akupan2012
/
mnogomernmasiv
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Main.java
45 строк
1 KB
akupan2012
upload files
21 окт 2025, 19:42
21 окт 2025, 19:42
bc66d8d
Код
Авторство
О чём код?
import java.util.Random; public class Main { public static final int SIZE = 8; public static void main(String[] args) { System.out.println("Первоначальная матрица"); 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.format("%4d", colors[i][j]); } System.out.println(); } printRotatedColors(colors); } public static void printRotatedColors(int[][] 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("Перевернутая матрица"); printMatix(rotatedColors); } public static void printMatix(int[][] rotatedColors) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { System.out.format("%4d", rotatedColors[i][j]); } System.out.println(); } } }