GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java/IntersectArrays.java at master · anshuman101/java

Expand file tree

/

IntersectArrays.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
39 lines (38 loc) · 699 Bytes
/

IntersectArrays.java

Copy path

File metadata and controls

39 lines (38 loc) · 699 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.