Skip to content

Commit c8dd3aa

Browse files
committed
CommonElementsInTwoArrays.c
1 parent fd7671d commit c8dd3aa

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

CommonElementsInTwoArrays.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
int i,j,n;
5+
printf("enter the number of elements in an arrays\n");
6+
scanf("%d",&n);
7+
int a[n],b[n];
8+
printf("enter the elements of 1st array\n");
9+
for(i=0;i<n;i++)
10+
{
11+
scanf("%d",&a[i]);
12+
}
13+
printf("enter the elements of 2nd array\n");
14+
for(j=0;j<n;j++)
15+
{
16+
scanf("%d",&b[j]);
17+
}
18+
printf("The common numbers are: ");
19+
for(i=0; i<n; i++){
20+
for(j=0;j<n;j++){
21+
if(a[i]==b[j]){
22+
printf("%d\n", b[j]);
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)