#include
int i,j;
char display(i)
{
if(j==0) return 'x';
if(j==1) return 'y';
if(j==2) return 'z';
return 0;
}
int main()
{
float a[3][4],d,x,y,z;
system("clear");
for(i=0;i<3;i++)
{
printf("\n\tEnter the values of equation %d\n",i+1);
for(j=0;j<4;j++)
{
if(j!=3) printf("\tEnter the coefficent of %c = ",display(j));
else printf("\tEnter the value of equat = ");
scanf("%f",&a[i][j]);
}
}
d=((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[2][0]*a[1][2]))+(a[0][2]*(a[1][0]*a[2][1]-a[1][1]*a[2][0])));
x=((((a[0][3]*(a[1][1]*a[2][2]-a[1][2]*a[2][1]))-(a[0][1]*(a[1][3]*a[2][2]-a[2][3]*a[1][2]))+(a[0][2]*(a[1][3]*a[2][1]-a[1][1]*a[2][3]))))/d);
y=((((a[0][0]*(a[1][3]*a[2][2]-a[1][2]*a[2][3]))-(a[0][3]*(a[1][0]*a[2][2]-a[2][0]*a[1][2]))+(a[0][2]*(a[1][0]*a[2][3]-a[1][3]*a[2][0]))))/d);
z=((((a[0][0]*(a[1][1]*a[2][3]-a[1][3]*a[2][1]))-(a[0][1]*(a[1][0]*a[2][3]-a[2][0]*a[1][3]))+(a[0][3]*(a[1][0]*a[2][1]-a[1][1]*a[2][0]))))/d);
printf("\tThe solution is\n\tDelta = %f,\n\tX= %f,\n\tY= %f,\n\tZ= %f\n",d,x,y,z);
return 0;
}
Nov 17, 2008
Cramers' Rule
Posted by
bikash pradhan
at
7:19 PM
Labels: Cramers rule
Subscribe to:
Post Comments (Atom)
Search
Programs
- backward difference formula c program code (1)
- Bisection Method c program code (1)
- Cramers rule (1)
- False position (1)
- Forward Difference Formula c program code (1)
- Gauss Seidal Method c program code (1)
- Guass Elimination Method c program code (1)
- Method of Successive Approximation c program code (1)
- Newton Raphson Method c program code (1)
- Newton's Backward Interpolation Formula c program code (1)
- Newton's Forward Interpolation Formula c program code (1)
- Regula Falsi on False Position Method c program code (1)
- Simpson's 1/3 Rule c program code (1)
- Simpson's Simpsons' 3/8 rule c program code (1)
- Trapezoidal Rule C program code (1)
0 comments:
Post a Comment