GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — CoreJavaPrograms/src/Programs/E12_Linearsearchinarray.java at main · Divya-learn/CoreJavaPrograms Expand file tree/ Copy pathE12_Linearsearchinarray.javaMore file actions 47 lines (32 loc) · 983 Bytes / Copy pathE12_Linearsearchinarray.javaFile metadata and controls47 lines (32 loc) · 983 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 package src.Programs; import javax.swing.*; import java.util.Scanner; public class E12_Linearsearchinarray { public static void main(String[] args) { //Find the element in array (linear search) Scanner sc = new Scanner(System.in); System.out.println("Enter any 6 number"); int[] array = new int[6]; for(int i=0;i<array.length;i++) { array[i] = sc.nextInt(); } System.out.println("Enter the element which number need to search"); int searchelement = sc.nextInt(); //50 boolean status =false; //10 20 30 40 70 50 for(int i=0;i<array.length;i++) { if(array[i] == searchelement) { System.out.println("Match found"+array[i]); status = true; break; } } if(status == false) { System.out.println("not Match found"); } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |