import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//Objeto para leer los datos de entrada
Scanner teclado = new Scanner(System.in);
int filas = teclado.nextInt();
int columnas = teclado.nextInt();
llenarMatriz(filas, columnas);
teclado.close(); //Cierra el scanner
}
//Metodo para llenar la matriz
public static void llenarMatriz(int x, int y) {
Random aleatorio = new Random();
//
String abc[][] = new String[x][y];
//
for (int filas = 0; filas < x; filas++) {
//
for (int columnas = 0; columnas < y; columnas++) {
int intAleatorio = aleatorio.nextInt(100);
abc[filas][columnas] = String.valueOf(intAleatorio);
}
}
LetraT(x, y, abc);
}
//Metodo que forma la letra T
public static void LetraT(int XX, int YY, String arregloLETRAT[][]) {
String concatenar = "";
int otrAv = YY / 2;
for (int fila = 0; fila < XX; fila++) {
for (int colu = 0; colu < YY; colu++) {
if (0 == fila || otrAv == colu) {
concatenar = concatenar + " " + "-----";
} else {
concatenar = concatenar + " . "
+ arregloLETRAT[fila][colu];
}
}
concatenar = concatenar + "\n\n";
}
concatenar = concatenar + "\n\n"
+ "Figura T en Matriz";
System.out.println(concatenar);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: