Advertisement
YavorGrancharov

Equal_Sequence_of_Elements_in_Array

Jun 16th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Equal_Sequence_of_Elements_in_Array
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var array = Console.ReadLine()
  14.                 .Split()
  15.                 .Select(int.Parse)
  16.                 .ToArray();
  17.  
  18.             var equal = string.Empty;
  19.  
  20.             for (int i = 0; i < array.Length; i++)
  21.             {
  22.                 for (int j = i + 1; j < array.Length; j++)
  23.                 {
  24.                     if (array[i] == array[j])
  25.                     {
  26.                         equal = "Yes";
  27.                     }
  28.                     else
  29.                     {
  30.                         equal = "No";
  31.                     }
  32.                 }
  33.             }
  34.             Console.WriteLine(equal);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement