title: Entering elements into an array and checking to see if the element already exists
body: <p>I'm working on a problem and i've tried it every way I can think of with a for loop but i can't figure out how to make it work as I only started on c# and programming as a whole a few weeks ago.</p>
  
  <p>Write an app that inputs five numbers. As each number is read search the array if the number doesn’t exist in the array output the word “new” and insert the number into the array. If the number does exist in the array output “exists”. Once all five numbers have been entered output the content of the array.</p>
  
  <p>This is what I have so far. Thanks for any help</p>
  
  <pre><code>using System;
  
  public class Program
  {
     // Main method begins execution of C# application
     public static void Main(string[] args)
     {
        int[] array = new int[5];
  
        for (int i = 0; i &lt; array.Length; i++)
        {
           Console.WriteLine("Enter a number:");
           array[i] = Convert.ToInt32(Console.ReadLine());
  
           for (int a = 0; a &lt; 5; a++)
           {
  
              if (array[i] != array[a])
              {
                 array[i] = int.Parse(Console.ReadLine());
                 Console.WriteLine("new\n");
              }
  
           }
  
           array[i] = int.Parse(Console.ReadLine());
           Console.WriteLine("exists\n");
        }
  
        Console.WriteLine(array);
        Console.ReadKey();
     }
  } // end class
  </code></pre>