import java.util.*;
import java.lang.*;
import java.io.*;
//import java.util.Random;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
Scanner tecl = new Scanner(System.in);
//
String [] vector = new String[5];
//
int [] otroArreglo = {125,150,175,200,225,250,275,300,325};
int tama = otroArreglo.length;
//
System.out.println("El tamaño de arreglo de una dimención (Vector) es: " + tama);
//
for(int v=0; v < otroArreglo.length; v++){
//
System.out.println("\nEn la posición : " + v + " se encuentra el valor de: " + otroArreglo[v]);
//
if(v<vector.length){
vector[v] = tecl.nextLine();
}
}
System.out.println("\n Impresiíon del vector inverso\n");
//
for(int v=(otroArreglo.length-1); v >= 0; v--){
//
System.out.print(" - " + otroArreglo[v]);
}
int [][] arreglo2D;
int f=0;
int c=0;
System.out.println("\nCuantas filas desea agregarle a su matriz: ");
f = tecl.nextInt();
System.out.println("Cuantas columnas desea agregarle a su matriz: ");
c = tecl.nextInt();
//
arreglo2D = new int[f][c];
//
Random rock = new Random();
System.out.println("Valores f y c : " + f + " - " + c);
for(int i=0; i<f; i++){
for (int j=0; j<c; j++){
//
int x = rock.nextInt(99);
//System.out.println("Valor a guardar en la matriz: " + x);
arreglo2D[i][j] = x;
}
}
//
System.out.println("\n Valor en la fil 3 columna 2: " + arreglo2D[2][1] );
System.out.println("\n\n" );
System.out.println("\n Impresión de matriz normal \n: " );
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
System.out.print(arreglo2D[i][j] + " - ");
}
//
System.out.println("\n");
}
System.out.println("\n\n" );
System.out.println("\n Impresión de matriz normal \n: " );
//CORREGIR para QUE SEA la impresión INVERSA
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
System.out.print(arreglo2D[i][j] + " - ");
}
//
System.out.println("\n");
}
System.out.println("\nDiagonal de normal\n" );
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
if(i==j){
System.out.print("00 -");
}else{
System.out.print(arreglo2D[i][j] + " - ");
}
}
//
System.out.println("\n");
}
System.out.println("\nImpresión de la L\n" );
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
if(j==0 || i==(f-1)){
System.out.print("00 - ");
}else{
System.out.print(arreglo2D[i][j] + " - ");
}
}
//
System.out.println("\n");
}
System.out.println("\nImpresión de la L inversa\n" );
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
if(j==(c-1) || i==(f-1)){
System.out.print("00 - ");
}else{
System.out.print(arreglo2D[i][j] + " - ");
}
}
//
System.out.println("\n");
}
System.out.println("\nImpresión de la X\n" );
int Xinversa=c-1;
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
if(i==j || Xinversa == j){
System.out.print("000 - ");
}else{
System.out.print(arreglo2D[i][j] + " - ");
}
}
Xinversa--;
//
System.out.println("\n");
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: