2012420062, Yudha S.P, Tugas 13 (Sequential Sort), SEmester 3

2012420062, Yudha S.P, Tugas 13 (Sequential Sort), SEmester 3

import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
public class SequentialSearch {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  
        String inputan = JOptionPane.showInputDialog(null, "Masukan Nilai perhitungan (pisah dengan koma)");
        String temp[]=inputan.split(",");
       
        String cari= JOptionPane.showInputDialog(null, "Cari Nilai");
        int index=0;
        boolean a=false;
       
        while(!a && index<temp.length){
            if(Integer.parseInt(cari)==Integer.parseInt(temp[index])){
                a=true;
            }
            index++;
        }
        if(a==true){
            System.out.println("Nilai Perhitungan "+inputan);
            System.out.println("angka "+cari+" ada pada index ke "+(index));
        }else
            System.out.println("Nilai "+cari+" Tidak Ditemukan");
}  
       
}






   




share this article to: Facebook Twitter Google+ Linkedin Technorati Digg
Posted by arek informatika, Published at 14.57 and have 0 komentar

Tidak ada komentar:

Posting Komentar