import javax.swing.JOptionPane;
public class pengurutan {
public static void main(String[] args){
String ukuran = JOptionPane.showInputDialog(null, "Ukuran Array");
//pesan tempat untuk array ukuran n (tipe integer)
int n = Integer.parseInt(ukuran);
//input array ukuran n - random integer
int a[]=new int[n];
for (int i=0; i<=n-1; i++ )
{
a[i]=(int) (Math.random()*10);
}
//display data array
System.out.println("Banyak data = " +n);
System.out.print("Data Sebelum diurutkan = ");
for (int i=0;i<=n-1; i++){
System.out.print(a[i]+" ");
}
}
}
public class pengurutan {
public static void main(String[] args){
String ukuran = JOptionPane.showInputDialog(null, "Ukuran Array");
//pesan tempat untuk array ukuran n (tipe integer)
int n = Integer.parseInt(ukuran);
//input array ukuran n - random integer
int a[]=new int[n];
for (int i=0; i<=n-1; i++ )
{
a[i]=(int) (Math.random()*10);
}
//display data array
System.out.println("Banyak data = " +n);
System.out.print("Data Sebelum diurutkan = ");
for (int i=0;i<=n-1; i++){
System.out.print(a[i]+" ");
}
}
}
0 komentar:
Posting Komentar