Khoi

Khoi

  • NA
  • 18
  • 0

Array list

Oct 26 2009 8:57 AM
Below is my code

    class Program
    {
        static void Main(string[] args)
        {
            int[] input = new int[5];
            Console.WriteLine("Pls input 5 nums:\n");
           
            for (int i = 0; i < 5; i++)
            {
                Console.Write("Number [" + i + "] is ");
                input[i] = Convert.ToInt32(Console.ReadLine());
            }
            Console.WriteLine("Nums u just entered are: ");
            for (int i = 0; i < 5; i++)
            {
                Console.Write(input[i] + " ");
                Console.ReadLine();
            }
               
        }
    }
}

I expect the outcome lists all the numbers horizontally as a array instead of entering many times. Please advise how to do that.

Thanks,
Ice

Answers (3)