Advertisement
skipter

C# Index == Num in Array

Jun 24th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 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. namespace _2.ElemntEqualIndex
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[] findTheEqualIndex = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  13.             string empryString = string.Empty;
  14.  
  15.             for (int cnt = 0; cnt < findTheEqualIndex.Length; cnt++)
  16.             {
  17.                 if (cnt == findTheEqualIndex[cnt])
  18.                 {
  19.                     empryString += cnt + " ";
  20.                 }
  21.             }
  22.             Console.WriteLine(empryString);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement