answersLogoWhite

0


Best Answer

#include"stdio.h"

#include"conio.h"

#include"math.h"

void main()

{

int i,j;

float a[3][4],b[3][4],c[4][4];

float x,y,z,p,q,r;

m:

printf("\nEnter the coefficients: ");

for(i=0;i<3;i++)

for(j=0;j<3;j++)

scanf("%f",&a[i][j]);

printf("\nEnter the constants: ");

for(i=0;i<3;i++)

scanf("%f",&a[i][3]);

if(a[0][0]!=0.0)

{

p=a[1][0];

q=a[0][0];

r=a[2][0];

for(j=0;j<=3;j++)

{

b[0][j]=-(p/q)*a[0][j];

a[1][j]+=b[0][j];

c[0][j]=-(r/q)*a[0][j];

a[2][j]+=c[0][j];

}

p=a[2][1];

q=a[1][1];

for(j=0;j<=3;j++)

{

b[1][j]=-(p/q)*a[1][j];

a[2][j]+=b[1][j];

}

printf("\n\nThe matrix becomes\n");

for(i=0;i<3;i++)

{

for(j=0;j<4;j++)

{

printf("%.4f\t",a[i][j]

}

printf("\n");

}

z=a[2][3]/a[2][2];

y=(a[1][3]-a[1][2]*z)/a[1][1];

x=(a[0][3]-a[0][2]*z-a[0][1]*y)/a[0][0];

printf("\nThe solution is");

printf("\nX=%f, Y=%f , Z=%f",x,y,z);

}

else

{

printf("\nThe first cofficient must not be zero,Enter again");

goto m;

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program for gauss elimination method to solve linear algebraic equations?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the use of gaussian elimination in education world situations?

Gaussian elimination is used to solve systems of linear equations.


What is the classification of a system of equations?

The answer will depend on what kinds of equations: there are linear equations, polynomials of various orders, algebraic equations, trigonometric equations, exponential ones and logarithmic ones. There are single equations, systems of linear equations, systems of linear and non-linear equations. There are also differential equations which are classified by order and by degree. There are also partial differential equations.


What are the different Types of mathematical equations?

Algebraic equations, trigenometric equations, linear equations, geometric equations, partial differential equations, differential equations, integrals to name a few.


What are two symbolic techniques used to solve linear equations?

Elimination and substitution are two methods.


What is a method for solving a system of linear equations in which you multiply one or both equations by a number to get rid of a variable term?

It is called solving by elimination.


How do you find the solution set of pair linear equations?

By the substitution method By the elimination method By plotting them on a graph


How do you decide whether to use elimination or subsitution to solve a three-variable system?

There is no simple answer. Sometimes, the nature of one of the equations lends itself to the substitution method but at other times, elimination is better. If they are non-linear equations, and there is an easy substitution then that is the best approach. With linear equations, using the inverse matrix is the fastest method.


What are two symbolic techniques used to solve linear equations and which do you feel is better?

Elimination and substitution are two methods.


Solve linear equations with complex coefficients on both sides?

You would solve them in exactly the same way as you would solve linear equations with real coefficients. Whether you use substitution or elimination for pairs of equations, or matrix algebra for systems of equations depends on your requirements. But the methods remain the same.


Write a c language program that solves linear equations using gauss-jordan elimination method?

Too complex to show here as a Wiki.Answer hoy pareha ta way i answer.......... pag sure uie.........


When is it best to solve a systems of linear equations using elimination?

Elimination is particularly easy when one of the coefficients is one, or the equation can be divided by a number to reduce a coefficient to one. This makes substitution and elimination more trivial.


How did the system of equations develop?

The system of equations developed from the early days with ancient China playing a foundational role. The Gaussian elimination was initiated as early as 200 BC for purposes of solving linear equations.