Source Code Java Nilai Max & Min
Menggunakan software JCreator.
Buat yang lagi butuh coding Max & Min di Java.
Saya kasih pencerahan, yuk langsung liat aja di bawah :
class NilaiMax {
public static void main(String[] args) {
int[] A={10,30,4,8,34,45,43,87,57,12};
int i=0, MAX=A[0], MIN=A[0];
while(i<=9){
if(A[i]<=MIN)MIN=A[i];
i++;
if(A[i]>=MAX)MAX=A[i];
i++;
}
for(i=0;i<=9;i++)
System.out.print(" "+A[i]);
System.out.println();
System.out.print("MIN= "+MIN);
System.out.println();
System.out.print("MAX= "+MAX);
System.out.println();
}
}
Buat yang lagi butuh coding Max & Min di Java.
Saya kasih pencerahan, yuk langsung liat aja di bawah :
class NilaiMax {
public static void main(String[] args) {
int[] A={10,30,4,8,34,45,43,87,57,12};
int i=0, MAX=A[0], MIN=A[0];
while(i<=9){
if(A[i]<=MIN)MIN=A[i];
i++;
if(A[i]>=MAX)MAX=A[i];
i++;
}
for(i=0;i<=9;i++)
System.out.print(" "+A[i]);
System.out.println();
System.out.print("MIN= "+MIN);
System.out.println();
System.out.print("MAX= "+MAX);
System.out.println();
}
}
Jangan Lupa Comment.
1 comments:
haahahahahah
makasi...
Post a Comment