Tagless
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* MatrixInput
|
||||
*/
|
||||
public class MatrixInput {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Please enter the 2D Array here: ");
|
||||
System.out.println("Numbers of rows: ");
|
||||
int rows = sc.nextInt();
|
||||
System.out.println("Numbers of columns: ");
|
||||
int columns = sc.nextInt();
|
||||
int[][] arr = new int[rows][columns];
|
||||
for (int i = 0; i < rows; i++) {
|
||||
for (int j = 0; j < columns; j++) {
|
||||
arr[i][j] = sc.nextInt();
|
||||
}
|
||||
}
|
||||
System.out.println("");
|
||||
for (int i = 0; i < rows; i++) {
|
||||
for (int j = 0; j < columns; j++) {
|
||||
System.out.print(arr[i][j]);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user