import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
int [] x = new int[10];
for(int j=0; j<10; j++)
{
System.out.print("Masukkan data = ");
x[j] = sc.nextInt();
}
for (int i=0; i<=9; i++)
System.out.println(x[i]);
int cari;
System.out.print("Cari data = ");
cari = sc.nextInt();
int k;
for(k=0; k<10; k++)
if (cari == x[k])
{
System.out.println("Data ditemukan");
break; //hentikan perulangan
}
if (k == 10) //pencarian sdh melebihi batas indeks array
System.out.println("Data tidak ada");
}
}
Ass,, Pak boleh dijelasin g Pak perbedaan antara JBuilder dengan NetBeans??
ReplyDeleteterima kasih Pak,,