-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonEltBetweenTwoArray.cs
45 lines (37 loc) · 1.12 KB
/
CommonEltBetweenTwoArray.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1.DemoA
{
class CommonEltBetweenTwoArray
{
public void CommonElement(int []x, int [] y)
{
Console.WriteLine("Common element................................................");
foreach (var arr in x)
{
int flag = 0;
foreach(var arr1 in y)
{
if (x == y)
{
flag = 1;
}
}
if (flag == 1)
Console.WriteLine(x + " " + y);
Console.ReadLine();
}
}
static void Main(string[] args)
{
int[] arr = { 12, 14, 16, 18, 20 ,32};
int[] arr1 = { 14, 21, 18, 20, 25, 38 };
CommonEltBetweenTwoArray ce = new CommonEltBetweenTwoArray();
ce.CommonElement(arr,arr1);
Console.ReadLine();
}
}
}