Programa en java para llenar una matriz triangular superior.
2 3 4 4
0 3 7 2
0 0 8 9
0 0 0 3
import java.io.*;
class matriz_05 {
static int mat[][]=new int[100][100];
public static void main(String[] args)throws IOException {
int n;
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Introduzca n: ");
n=Integer.parseInt(br.readLine());
System.out.println();
System.out.println("Introduzca elementos a la matriz: ");
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(j>=i){
mat[i][j]=Integer.parseInt(br.readLine());
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
System.out.print(" "+mat[i][j]);
}
System.out.println();
}
}
}
Comentarios
Mysuru Casino - The Home of the Best of the Slots! Visit poormansguidetocasinogambling.com us to Play the best slots and enjoy the best febcasino table games 바카라 사이트 in our casino. Visit gri-go.com us