Gauss–Jordan Method

Source Code:

Write a program in C to solve the system of equations using the Gauss–Jordan Method:
πŸπ’™ + π’š βˆ’ 𝒛 = πŸ– βˆ’ πŸ‘π’™ βˆ’ π’š + πŸπ’› = βˆ’πŸπŸ βˆ’ πŸπ’™ + π’š + πŸπ’› = βˆ’3

#include <stdio.h>
#include <conio.h>
int main(){
 clrscr();
 int i,j,k; double a[3][4]={{2,1,-1,8},{-3,-1,2,-11},{-2,1,2,-3}},f;
 for(i=0;i<3;i++){
 f=a[i][i];
 for(j=0;j<4;j++) a[i][j]/=f;
 for(k=0;k<3;k++){
 if(k!=i){
 f=a[k][i];
 for(j=0;j<4;j++) a[k][j]-=f*a[i][j];
 }
 }
 }
 printf("\n");
 for(i=0;i<3;i++) printf("\tx%d=%.2f\n",i+1,a[i][3]);
 getch();
 return 0;
}

Output