/**
* Program : Pencarian data dengan Sequential Search
* Date : 23 Juni 2022
* Author : Riyanto
* Website : www.melonkoding.com
*/
class Main {
static int[] data = {32, 12, 67, 4, 29};
public static void main(String[] args) {
if(search(4)) {
System.out.println("Data ketemu");
} else {
System.out.println("Data tidak ketemu");
}
}
static boolean search(int cari) {
for(int i=0; i<data.length; i++) {
if(data[i] == cari) {
return true;
}
}
return false;
}
}