write a program in c language that is able to compute the
determinant of any 5*5 matrix from your program with at
least five examples and print the result
Answer Posted / vasanthi
#include<conio.h>
#include<stdio.h>
int a[20][20],m;
int determinant(int f[20][20],int a);
int main()
{
int i,j;
printf("----------------------------------------------------------------------\n");
printf("-------------------made by C code champ ------------------------------\n");
printf("----------------------------------------------------------------------\n");
printf("\n\nEnter order of matrix : ");
scanf("%d",&m);
printf("\nEnter the elements of matrix\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=m;j++)
{
printf("a[%d][%d] = ",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\n\n---------- Matrix A is --------------\n");
for(i=1;i<=m;i++)
{
printf("\n");
for(j=1;j<=m;j++)
{
printf("\t%d \t",a[i][j]);
}
}
printf("\n \n");
printf("\n Determinant of Matrix A is %d .",determinant(a,m));
getch();
}
int determinant(int f[20][20],int x)
{
int pr,c[20],d=0,b[20][20],j,p,q,t;
if(x==2)
{
d=0;
d=(f[1][1]*f[2][2])-(f[1][2]*f[2][1]);
return(d);
}
else
{
for(j=1;j<=x;j++)
{
int r=1,s=1;
for(p=1;p<=x;p++)
{
for(q=1;q<=x;q++)
{
if(p!=1&&q!=j)
{
b[r][s]=f[p][q];
s++;
if(s>x-1)
{
r++;
s=1;
}
}
}
}
for(t=1,pr=1;t<=(1+j);t++)
pr=(-1)*pr;
c[j]=pr*determinant(b,x-1);
}
for(j=1,d=0;j<=x;j++)
{
d=d+(f[1][j]*c[j]);
}
return(d);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
who discovered the groups of blood?
who is the winner of woman's single title in french open tennis championship 2011
If Nasa where to sink a large tube down a few miles into one of the deepest parts of the ocean or a spiral tube not so deep. Then fit electromagnetic monorail running gear to a sledge and then put a space cargo vehicle inside the sledge. With ball valves to compartmentalise the tube off to keep a constant pressure with inert gases as the space shuttle accelerates using electromagnetism to gain altitude and then loses the sledge. Next fires it's main rocket engines to carry on up to space. Would this idea work and would it save money on fuel if the space cargo vehicles where only say 5 ton cargo holds. Also they could be reusable with their rocket engines.
How to do market basket analysis in base sas?
write a program which calculates for every five digit integer entered on a keyboard, a numerical code computed as follows:first digit multiplied by 2+ second digit divided by 3 and the quotient multiplied by the third digit, + the fourth digit + the fifth digit divided by 2. the program should then display the following results 1, the code calculated from the integer value entered 2, the character value corresponding to the code as per the ASCII TABLE 3, Given any three 5-digit integer number, display the corresponding three-character code key:
if they ask me thet u have any body in us and i have aaunt in us then what i ans to them yes or no
what is Acute Lower Respiratory Tract Infection?
What is the general IQ of the human being?
why do u want to leave your present job?
different between dicot & monocot with example ?
1.how can you obtain D flip-flop and t flip -flop using jk flip- flop? 2.2 derive the expression of susceptibility of atiferromagnetic materials above neel temperature?
How to create short keys in vb.net
What are the properties of ACID? Please help me I have no clue of it Thank you for everyones support who actually helped, I really appreciate it I will give something back for it. Thank you
Assuming that the constitution parameters of aluminum are given by μ=μ۪o=4Πx10^(-7)N/A^2 and σ=3.54x10^7mho/m,find the frequency for which the skin depth in aluminum is 0.01 mm.
protocols of milk ring test ?