Answers for "3by3 Array c#"

C#
0

3by3 Array c#

int[,] OneToNine = new int[3, 3] {        /*0, 1, 2*/
                                    /*0*/ { 1, 2, 3 },
                                    /*1*/ { 4, 5, 6 },
                                    /*2*/ { 7, 8, 9 }
                         };
            Console.WriteLine(map[0, 0]); //1
            Console.WriteLine(map[0, 1]); //2
            Console.WriteLine(map[0, 2]); //3
            Console.WriteLine(map[1, 0]); //4
            Console.WriteLine(map[1, 1]); //5
            Console.WriteLine(map[1, 2]); //6
            Console.WriteLine(map[2, 0]); //7
            Console.WriteLine(map[2, 1]); //8
            Console.WriteLine(map[2, 2]); //9
//You will get the numbers below as output in the consol.
//1
//2
//3
//4
//5
//6
//7
//8
//9
Posted by: Guest on September-30-2021
0

3by3 Array c#

string[,] NumbersAsWords = new string[3, 3] {   /*0,     1,     2*/
                                    /*0*/ { "one", "two", "three" },
                                    /*1*/ { "four", "five", "six" },
                                    /*2*/ { "seven", "eight", "nine"}
                         };
            Console.WriteLine(map[0, 0]); //one
            Console.WriteLine(map[0, 1]); //two
            Console.WriteLine(map[0, 2]); //three
            Console.WriteLine(map[1, 0]); //four
            Console.WriteLine(map[1, 1]); //five
            Console.WriteLine(map[1, 2]); //six
            Console.WriteLine(map[2, 0]); //seven
            Console.WriteLine(map[2, 1]); //eight
            Console.WriteLine(map[2, 2]); //nine
//You will get the words below as output in the consol.
//one
//two
//three
//four
//five
//six
//seven
//eight
//nine
Posted by: Guest on September-30-2021

C# Answers by Framework

Browse Popular Code Answers by Language