4
Answers

How to show results horizontally

Khoi

Khoi

15y
3.2k
1
Below is my code and I expect the numbers show horizontally, but they show vertically. Please advise. Thanks

{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Array1 = { 2, 3, 4 };
            int[] Array2 = { 1, 2, 3 };
            int[] Array3 = new int[3];


  
                Console.WriteLine("\n The Contents of Array1 is: ");
                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine("{0} \t", Array1[i]);
                }
                Console.WriteLine("\n The Contents of Array2 is: ");
                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine("{0} \t", Array2[i]);
                }
   
      
            for (int i = 0; i < 3; i++)
            {
                Array3[i] = Array1[i] - Array2[i];
            }

                Console.WriteLine("\n The result of sub is : ");
                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine("{0} \t", Array3[i]);
                }
               
           
            Console.ReadLine();
        }
    }
}
Answers (4)