//Determinant of a
2*2 Matrix
#include<stdio.h>
#include<conio.h>
void
main()
{
int
i,j,a[2][2],det;
clrscr();
printf("Enter
the elements of matrix\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Matrix
is\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n\n");
}
det=a[0][0]*a[1][1]-a[0][1]*a[1][0];
//calculation of determinant
printf("Determinant
of 2*2 Matrix is = %d",det);
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.