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 — java/IntersectArrays.java at master · anshuman101/java Expand file tree/ Copy pathIntersectArrays.javaMore file actions 39 lines (38 loc) · 699 Bytes / Copy pathIntersectArrays.javaFile metadata and controls39 lines (38 loc) · 699 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 import java.util.Scanner; class IntersectArrays{ public static void main(String[] Args) { int i,j; Scanner sc=new Scanner(System.in); System.out.println("Intersection of two arrays"); int A[]=new int[10]; int B[]=new int[10]; System.out.println("enter the first array(Sorted)"); for(i=0;i<10;i++) { A[i]=sc.nextInt(); } i=0; System.out.println("enter the second array(Sorted)"); for(i=0;i<10;i++) { B[i]=sc.nextInt(); } i=0; j=0; while(i!=10&&j!=10) { if(A[i]==B[j]) { System.out.print(A[i]+" ,"); i++; j++; } else if(A[i]>B[j]) j++; else if(A[i]<B[j]) i++; } sc.close(); } } |
| You are visitor 01402503 — 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. |