How to calculate determinant of n x n matrix?

Sajo

Member
Joined
Jul 22, 2020
Messages
17
Programming Experience
Beginner
Hello everybody. I create n x n matrix where I must calculate determinant but I don´t know how. Please can you help me?
Here is code of my matrix
C#:
Console.WriteLine("Enter number of rows and columns in your matrix");

int n = int.Parse(Console.ReadLine());
int[,] l = new int[n, n];

Console.WriteLine("Enter numbers of your matrix");

for(int i = 0; i < n; i++)
{
    for(int j = 0; j < n; j++)
    {
        l[i,j] = int.Parse(Console.ReadLine());
    }
}

Console.WriteLine("Now lets print your matrix");

for(int i = 0; i < n; i++)
{
    Console.WriteLine();

    for(int j = 0; j < n; j++)
    {
        Console.Write("{0}\t", l[i, j]);
    }
}
 
Last edited by a moderator:
How would you calculate the determinant of a matrix manually? Can you describe the steps you take? If so, then you have your algorithm. Now it's just a matter of translating your steps into code.
 
Yes but I am interested in making a program where the user enters an arbitrary number of rows and columns of the matrix and then the numbers of that matrix and then calculates the determinant of that matrix. I would create these steps myself to know the exact number of columns and rows. But this is a program where arbitrary numbers of columns and rows are included
 

Latest posts

Back
Top Bottom