title: how to display repeated element postions in an array in c#
body: <p>how to display repeated elements with their index position in an array in c# console</p>
  
  <p>I have this problem 
  in simple c#
  user has given me 5 numbers and  stored in an array and now i gave user the option to check the numbers with respect to its position </p>
  
  <p>Now the problem is if in the 5 numbers user had stored earlier has 2 or more same numbers..how do i display those both with their positions?</p>
  
  <pre><code>using System;
  
  namespace ConsoleApplication3
  {
      class Program
      {
          static void Main(string[] args)
          {
              int[] arr = new int[5];
              int check = 0;
              int position = 0;
  
              Console.WriteLine("Enter 5 elements");
  
              for (int i = 0; i &lt; 5; i++)
              {
                  arr[i] = Convert.ToInt32(Console.ReadLine());
              }
  
              int value;
              Console.WriteLine("Enter no to search");
              value = Convert.ToInt32(Console.ReadLine());
  
              for (int i = 0; i &lt; 5; i++)
              {
                  if (value==arr[i])
                  {
                      {
                          check = 1;
                          position = i;
  
                      }
                  }
              }
              if (check == 1)
              {
                  Console.WriteLine("number is found At position " +position);
              }
              else
              {
                  Console.WriteLine("not found");
              }
              Console.ReadKey();
          }
      }
  }
  </code></pre>
  
  <p>please help me </p>
  
  <p>If user entered the numbers as 1 2 3 1 2
  and they are stored
  then when user searches nos
  it should display number is found at position of 1st  and 2nd??
  help</p>