Nah Kali Ini saya memposting algoritma dan program array mencari nilai terkecil menggunakan java.
Algoritma Mencari Nilai Terkecil
A = 0
B = 0
Input Banyak Kolom = Kolom
Input Banyak Baris = Baris
Array X [Kolom][Baris]
Min = [100]
for a to Kolom do
for b to Baris do
Input Nilai Array = X [Kolom] [Baris]
If Array X [Kolom] [Baris] < Min
Min = X [Kolom] [Baris]
end for
end for
Write ( Nilai Terkecil Dari Array)
PROGRAM JAVA
package strukturdata;
import java.util.Scanner;
public class Strukturdata {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int a,b;
int min=100;
int kolom,baris;
System.out.print("Masukkan Banyak Kolom : ");
kolom=input.nextInt();
System.out.print("Masukkan Banyak Baris : ");
baris=input.nextInt();
System.out.println("==================================================");
System.out.println("|-----------------------------|");
int x[][]=new int[kolom][baris];
for (a=0;a<kolom;a++){
for (b=0;b<baris;b++){
System.out.print("| Masukkan Nilai Array : ");
x[a][b]=input.nextInt();
if (x[a][b]<min){
min=x[a][b];
}
}
System.out.println("|-----------------------------|");
}
System.out.println(" Nilai Terkecil Dari Array inputan : "+min);
System.out.println("\n=================>ADPPROJECT2017<=================");
}
Ok sekian Dari Saya Mohon maaf bila ada kekurangan,, Trimakasih..
Algoritma Mencari Nilai Terkecil
A = 0
B = 0
Input Banyak Kolom = Kolom
Input Banyak Baris = Baris
Array X [Kolom][Baris]
Min = [100]
for a to Kolom do
for b to Baris do
Input Nilai Array = X [Kolom] [Baris]
If Array X [Kolom] [Baris] < Min
Min = X [Kolom] [Baris]
end for
end for
Write ( Nilai Terkecil Dari Array)
PROGRAM JAVA
package strukturdata;
import java.util.Scanner;
public class Strukturdata {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int a,b;
int min=100;
int kolom,baris;
System.out.print("Masukkan Banyak Kolom : ");
kolom=input.nextInt();
System.out.print("Masukkan Banyak Baris : ");
baris=input.nextInt();
System.out.println("==================================================");
System.out.println("|-----------------------------|");
int x[][]=new int[kolom][baris];
for (a=0;a<kolom;a++){
for (b=0;b<baris;b++){
System.out.print("| Masukkan Nilai Array : ");
x[a][b]=input.nextInt();
if (x[a][b]<min){
min=x[a][b];
}
}
System.out.println("|-----------------------------|");
}
System.out.println(" Nilai Terkecil Dari Array inputan : "+min);
System.out.println("\n=================>ADPPROJECT2017<=================");
}
Ok sekian Dari Saya Mohon maaf bila ada kekurangan,, Trimakasih..
0 komentar:
Posting Komentar