Ads Top

Determinant of a matrix program using c

Determinant of a matrix ,program ,using c,lab,practicals,computer

Determinant of a matrix program

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],i,j,A;

clrscr();
printf("Enter the  matrix: ");
for(i=0;i<3;i++)
{
scanf(%d",&a[i][j]);
}
printf("The given matrix is :\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
A=a[0][0]*((a[1][1]*a[2][2])-(a[1][2]*a[2][1]))-a[0][1]*((a[1][0]*a[2][2])-(a[1][2]*a[2][0]))+a[0][2]*((a[1][0]*a[2][1])-(a[2][0]*a[1][1]));
printf("\n Determinant of given matrix is ::%d\t",A);
getch();
}


Output

Enter the matrix :
1
2
3
4
5
6
7
8
9

The given matrix is :
1     2      3 
4     5      6
7     8      9

Determinant of given matrix is::0

No comments:

Touchfeeds. Powered by Blogger.