Tuesday , November 19 2019

C# – More on arrays, loops and conditionals (Part 2)

 

This is the 2nd part of: More about arrays, loops and conditionals (Part 1)

Part 2:

Code for 3 x 3 matrix application:
Put this below static void main()

int[,] matrix = new int[3, 3]
    {
        {1,3,5},
        {6,7,8},
        {9,6,3}

    };

for (int i = 0; i < matrix.GetLength(0); i++) {

    for (int z = 0; z < matrix.GetLength(1); z++) {

        Console.Write(matrix[i,z]);

    }
    Console.WriteLine();
}
Console.Read();

 

About Waleed Baig

Waleed Baig
I am doing BS Computer Science. I have a passion to learn new technology and spread it. I am more enthusiastic about learning complex algorithm and making creative and efficient solution to a problem.

Check Also

C# 09 – Learning methods

In this tutorial we will learn What are methods? and How to create a method …

Leave a Reply

Your email address will not be published.