## May 2, 2012

### C Program to solve equations using Jordan elimination method.

Write a C Program to solve equations using Jordan elimination method.
Gauss-Jordan elimination method is used to solve the linear equations. In this method, We find the inverse matrix of the coefficients of equations by elementary row operations. Read more about C Programming Language . and read the C Programming Language (2nd Edition) by K and R.

```/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
*                      Happy Coding
***********************************************************/

#include<stdio.h>
#include<conio.h>
void solution( int a[][], int var );
int main()
{

int a[ 20 ][ 20 ], var, i, j, k, l;
clrcsr();
printf( "\nEnter the number of variables:\n" );
scanf( "%d", &var );

for ( i = 0;i < var;i++ )
{
printf( "\nEnter the equation%d:\n", i + 1 );

for ( j = 0;j < var;j++ )
{
printf( "Enter the coefficient of  x%d:\n", j + 1 );
scanf( "%d", &a[ i ][ j ] );
}

printf( "\nEnter the constant:\n" );
scanf( "%d", &a[ i ][ n ] );
}

solution( a, var );
return 0;
}

void solution( int a[ 20 ][ 20 ], int var )
{
int k, i, l, j;

for ( k = 0;k < var;k++ )
{
for ( i = 0;i <= var;i++ )
{
l = a[ i ][ k ];

for ( j = 0;j <= var;j++ )
{
if ( i != k )
a[ i ][ j ] = a[ k ][ k ] * a[ i ][ j ] – l * a[ k ][ j ];
}
}
}

printf( "\nSolutions:" );

for ( i = 0;i < n;i++ )
{
printf( "\nTHE VALUE OF x%d IS %f\n", i + 1, ( float ) a[ i ][ n ] / ( float ) a[ i ][ i ] );
}

}
```
```Read more Similar C Programs
Learn C Programming
Recursion
Number System```
You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!