C# problems with a for loop
<p>Can someone tell me why this doesnt work. When I enter the loop it prints everything instead of one line and get the users input. It prints Enter the integer the account numberEnter the integer the account balanceEnter the account holder lastname</p>

<p>Got it working thanks everyone, but now the searchaccounts doesnt work</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace ConsoleApplication1

{

class accounts

{

private int[] accountnum = new int[5]; //private accountnum array of five integer account numbers        

private int[] accountbal = new int[5];//private balance array of five balance amounts

private string[] accountname = new string[5];//private accntname array to hold five last names


        public void fillAccounts()
        {
            int bal;
            int accountnumber;
            string name;

            for (int x = 0; x &lt; 5; ++x)
            {

                Console.Write("Enter the integer the account number");
                accountnumber = Console.Read();
                Console.Write("Enter the integer the account balance");
                bal = Console.Read();
                Console.Write("Enter the account holder lastname");
                name = Console.ReadLine();

                accountnum[x] = accountnumber;
                accountbal[x] = bal;
                accountname[x] = name;
            }




        }
        public void searchAccounts()
        {
            Console.WriteLine("Enter the account number");
            int acctnum = Console.Read();
            for (int x = 0; x &lt; 6; ++x)
            {
                if (x &lt; 5)
                {
                    if (accountnum[x] == acctnum)
                    {
                        Console.WriteLine("Account #{0} has a balance of {1} for customer {2}", acctnum, accountbal[x].ToString("C"), accountname[x]);
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("You entered invalid account number");
                }
            }

        }
        public void averageAccounts()
        {
            int sum = 0;
            int avg;


            for (int x = 0; x &lt; 5; ++x)
            {
                sum = accountbal[x] + sum;
            }
            avg = sum / 5;
            Console.WriteLine("The average dollar amount is {0}", avg.ToString("c"));
        }
    }
    class assignment3_alt
    {
        static void Main(string[] args)
        {
            accounts myclass = new accounts();
            string userin;


            myclass.fillAccounts();
            int i = 0;
            while (i != 1)
            {//use the following menu:            
                Console.WriteLine("*****************************************");
                Console.WriteLine("enter an a or A to search account numbers");
                Console.WriteLine("enter a b or B to average the accounts");
                Console.WriteLine("enter an x or X to exit program");
                Console.WriteLine("*****************************************");
                Console.Write("Enter option--&gt;");
                userin = Console.ReadLine();
                if (userin == "a" || userin == "A")
                {
                    myclass.searchAccounts();
                }
                else if (userin == "b" || userin == "B")
                {
                    myclass.averageAccounts();
                }
                else if (userin == "x" || userin == "X")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("You entered an invalid option");
                }
            }
        }
    }
}
</code></pre>
