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



write a program in c language that is able to compute the determinant of any 5*5 matrix from your..

Answer / 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

More Sciences AllOther Interview Questions

What is the second smallest country in the world ?

1 Answers  


what does the term means? " the MAC of nitrous oxide is 104" MAC= minumum alveolar concerntration.

1 Answers  


describe atime when you felt it was necessary to change a staffing pattern to better meet your unit's needs. how did you handle the sutuation?

0 Answers   Royal Lancaster Hotel,


John was performing IS audit of a computer center. He noticed that two activities were performed by the same person. He did NOT report one of the following sets of activities as audit failure. Which one did he not report? A) Security operation and change management B) Computer operations and system development C) System development and change management D) System development and systems testing

0 Answers  


why do we get shocked by electric current?while earth has a 0 potential...

0 Answers  






If you eventually employed, what would be your contributions / roles with the company?

1 Answers   Royal Lancaster Hotel,


In which branch of mathematics should I specialise if I want to make a career in materials management?

0 Answers  


an iron ball bounce more than a cricket ball?

0 Answers  


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:

0 Answers  


how to make RIAD hard disk in windows xp 2? how to make Hard Disk mirror with DELL model 755?

0 Answers   Microsoft,


tell me about a time that you had to deal with a conflict between a licensed and unlicensed personnel and how you handled the situation?

5 Answers   ADNH Abu Dhabi National Hotels, Drury Hotels, Holiday Inn, Hotel Landmark, Rixos Bab Al Bahr, Royal Lancaster Hotel, St Anthony Hotel, St Rose Hospital, Thompson Hotels,


Hi I have done my B.Sc computers and my query is that do i have to compulsory write GRE or TOFEL to study in US. Please let me whether I am eligibly for GRE or TOFEL with B.Sc computers.... Regards Kamal

0 Answers  


Categories