daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Oct 15th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package linear_search;
  2.  
  3. public class LinearSearch {
  4.     public static void main(String[] args) {
  5.  
  6.         int[] arr = new int[] {5,1,8,96,1,8,2,8,4,6,3,8,1,6,8,6,1,6,4};
  7.        
  8.         linear(arr, 97);
  9.     }
  10.    
  11.     public static void linear(int[] arr, int targetValue) {
  12.        
  13.         for (int i=0; i < arr.length; i++) {
  14.             if (arr[i] == targetValue) {
  15.                 System.out.println(targetValue + "을 찾았습니다");
  16.             }
  17.         }
  18.         System.out.println("값이 존재하지 않습니다.");
  19.     }
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top