Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace _04.ArrayCoincedence
- {
- class ArrayCoincedence
- {
- static void Array_Coincedence(int[] array)
- {
- int count = 0;
- int coincedence = 0;
- for (int index = 0; index < array.Length; index++)
- {
- try
- {
- if (array[index] == array[index + 1])
- {
- coincedence = array[index];
- break;
- }
- }
- catch (Exception)
- {
- }
- }
- foreach (var numbers in array)
- {
- if (numbers == coincedence)
- {
- count++;
- }
- }
- Console.WriteLine(count);
- }
- static void Main(string[] args)
- {
- int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- Array_Coincedence(n);
- }
- }
- }
Add Comment
Please, Sign In to add comment