langsung saja ke TKP saya gak suka yg namanya basa-basi, ini dia sources code-nya...
public class array_nilaiMaxMin {
public static void main(String[] args) {
final int data =10;
int [] d = new int [data];
for (int i = 0; i < data; i++) {
d [i]= Integer.parseInt(JOptionPane.showInputDialog("Masukan Angka Array "+(i+1)));
}
int b=d[0];
int k=d[0];
for (int i = 0; i <data; i++) {
if (d[i]>b){
b=d[i];
}else if (d[i]<k){
k=d[i];}
}JOptionPane.showMessageDialog(null, "Isi Array : "+d[0]+" ,"+d[1]+
" ,"+d[2]+" ,"+d[3]+" ,"+d[4]+" ,"+d[5]+" ,"+d[6]+" ,"+d[7]
+" ,"+d[8]+" ,"+d[9]+
"\nNilai Terbesar : "+b+
"\nNilai Terkecil : "+k);
dan inilah hasil akir yang kita peroleh
public class array_nilaiMaxMin {
public static void main(String[] args) {
final int data =10;
int [] d = new int [data];
for (int i = 0; i < data; i++) {
d [i]= Integer.parseInt(JOptionPane.showInputDialog("Masukan Angka Array "+(i+1)));
}
int b=d[0];
int k=d[0];
for (int i = 0; i <data; i++) {
if (d[i]>b){
b=d[i];
}else if (d[i]<k){
k=d[i];}
}JOptionPane.showMessageDialog(null, "Isi Array : "+d[0]+" ,"+d[1]+
" ,"+d[2]+" ,"+d[3]+" ,"+d[4]+" ,"+d[5]+" ,"+d[6]+" ,"+d[7]
+" ,"+d[8]+" ,"+d[9]+
"\nNilai Terbesar : "+b+
"\nNilai Terkecil : "+k);
dan inilah hasil akir yang kita peroleh
selamat mencoba...!!
0 comments:
Post a Comment