rendered paste bodyimport javax.swing.*;
public class klasa {
/**
* @param args
*/
public static void main(String[] args) {
String txt;
int n;
do {
do {
txt=JOptionPane.showInputDialog("n=");
} while (txt==null || txt.isEmpty());
n=Integer.parseInt(txt);
} while (n<2 | n>5);
int [][]tab = new int [n][n];
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (j==0) {
tab[i][j] = (int) Math.random()*10;
}
if (j>0) {
tab [i][j] = (int)Math.pow(tab[i][0], j+1);
}
}
}
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
System.out.print(tab[i][j]+"\t");
}
System.out.println();
}
txt="";
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
txt+=tab[i][j]+" ";
}
txt+="\n";
}
JOptionPane.showMessageDialog(null, txt);
}
}