Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Lab {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] input = scanner.nextLine().split(", ");
- int size = Integer.parseInt(input[0]);
- String type = input[1];
- int[][] matrix = new int[size][size];
- int num = 1;
- if (type.equals("A")) {
- for (int col = 0; col < size; col++) {
- for (int rol = 1; rol <size; rol++) {
- matrix[rol][col] = num;
- num++;
- }
- }
- //} else if (type.equals("B")) {
- }
- for(int rows=0;rows<matrix.length;rows++){
- for(int cols=0;cols<matrix[rows].length;cols++){
- System.out.print(matrix[rows][cols]+" ");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement