-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAMEELEMENTTWOARRAY.py
52 lines (49 loc) · 1020 Bytes
/
SAMEELEMENTTWOARRAY.py
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
48
49
50
51
52
#include <stdio.h>
int printCommon(int arr1[], int len1, int arr2[],int len2) {
int i,j;
for(i = 0; i < len1 ;i++) {
for(j = 0; j < len2 ;j++) {
if(arr1[i] == arr2[j]){
printf("\n Common elements is %d", arr1[i]);
}
}
}
}
int main(void) {
/*
* For demostration purpose, i take these values in a code
* /
int arr1[] = {2,3,4,5,6};
int arr2[] = {4,6,7,8,9};
// Lenght of arr1 and arr2
int len1 = 5;
int len2 = 5;
printCommon(arr1,len1,arr2,len2);
return 0;
}
/**
* Find Common Elements in Two Sorted Arrays
*/
#include <stdio.h>
int printCommon(int arr1[], int len1, int arr2[],int len2) {
int i,j;
for(i = 0; i < len1 ;i++) {
for(j = 0; j < len2 ;j++) {
if(arr1[i] == arr2[j]){
printf("\n Common elements is %d", arr1[i]);
}
}
}
}
int main(void) {
/*
* For demostration purpose, i take these values in a code
* /
int arr1[] = {2,3,4,5,6};
int arr2[] = {4,6,7,8,9};
// Lenght of arr1 and arr2
int len1 = 5;
int len2 = 5;
printCommon(arr1,len1,arr2,len2);
return 0;
}