6. Write a program to demonstrate Gauss Jordan Method.

            
    /* Program to excute Gauss Jordan method*/
    #include <stdio.h>
    #include <conio.h>
    #define max 10
    void main()
    {
        int i, j, k, n;
        float a[max][max + 1], x[max], d;
        printf("Enter the number of equations\n");
        scanf("%d", &n);
        printf("Enter augmented matrix rowwise\n");
        for (i = 0; i < n; i++)
        {
            for (j = 0; j < n + 1; j++)
            {
                scanf("%f", &a[i][j]);
            }
        }
        for (j = 0; j < n; j++)
        {
            for (i = 0; i < n; i++)
            {
                if (i != j)
                {
                    d = a[i][j] / a[j][j];
                    for (k = 0; k < n + 1; k++)
                    {
                        a[i][j] = a[j][j] - a[j][k] * d;
                    }
                }
            }
        }
        printf("The solution of given systme is\n");
        for (i = 0; i < n; i++)
        {
            x[i] = a[i][n] / a[i][i];
            printf("x[i] = %f", x[i]);
        }
    }
            
            

Output

Output not available.