SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | ||
3 | class EqualElementsOfSequence | |
4 | { | |
5 | static void Main() | |
6 | { | |
7 | - | int a, b, count, maxCount, current; |
7 | + | int a, b, c, count, maxCount, current; |
8 | ||
9 | Console.Write("Enter size of the array: "); | |
10 | int num = int.Parse(Console.ReadLine()); | |
11 | int[] arr = new int[num]; | |
12 | ||
13 | count = 1; | |
14 | maxCount = 0; | |
15 | ||
16 | for (int indexOne = 0, indexTwo = 1; indexTwo < num; indexOne += 2, indexTwo += 2) | |
17 | { | |
18 | a = arr[indexOne]; | |
19 | b = arr[indexTwo]; | |
20 | if (a == b) | |
21 | { | |
22 | count++; | |
23 | if (count > maxCount) | |
24 | { | |
25 | maxCount = count; | |
26 | - | current = arr[indexOne]; |
26 | + | |
27 | else | |
28 | { | |
29 | continue; | |
30 | } | |
31 | } | |
32 | else | |
33 | { | |
34 | count = 1; | |
35 | } | |
36 | } | |
37 | ||
38 | - | int printed = current; |
38 | + | |
39 | - | |
39 | + | |
40 | { | |
41 | Console.Write("{0} ",a); | |
42 | } | |
43 | - | Console.Write("{0} ",current); |
43 | + | |
44 | } | |
45 | } |