Q:

Array - Two Dimensional concept using C#

0

This Program is used to arrange the elements using two dimensional array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

public class exam

 {

    public static void Main()

        {

            int i, j;

            string[,] Books = new string[3, 3];

            for (i = 0; i< 3; i++)

            {

                for (j = 0; j < 3; j++)

                {

                    Console.Write("\nEnter Book Name for {0}. Row and {1}. column:\t", i + 1, j + 1);

                    Books[i, j] = Console.ReadLine();

                }

         }

            Console.WriteLine("\n\n=========================");

            Console.WriteLine("All the element of Books array is:\n\n");



            Console.Write("\t1\t2\t3\n\n");



           for (i = 0; i< 3; i++)

            {

                Console.Write("{0}.\t", i + 1);



                for (j = 0; j < 3; j++)

                {

                    Console.Write("{0}\t", Books[i, j]);

                }

                Console.Write("\n");

            }

            Console.WriteLine("\n\n=========================");

          }

    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now