Ini Algoritmanya

1. untuk eliminasi maju

DO k = 1,n-1
    DO i = k+1,n
        factor = a[i,k] / a[k,k]
        DO j = k+1 to n
            a[i,j] = a[i,j] - factor * a[k,j]
        END DO
        b[i] = b[i] - factor * b[k]
    END DO
END DO


2. untuk eliminasi kebalikannya

x[n] = b[n] / a[n,n]
DO i = n-1,1,-1
    sum = 0
    DO j = 1+1,n
        sum = sum + a[i,j] * x[j]
    END DO
    x[i] = (b[i] - sum)/a[i,i]
END DO
 

 

listing programnya kira-2 jiga kieu

dalam bahaasa CCCCCCC

#include<stdio.h>
#include<conio.h>

main()
{
    int i,a[4][4],b[4],j,k;
    float x[4],sum,factor;

    clrscr();
    printf("assigment nilai");
    a[0][0]=3;a[0][1]=1; a[0][2]=2; a[0][3]=-1;b[0]=16;
    a[1][0]=1;a[1][1]=-4;a[1][2]=-1;a[1][3]=0;b[0]=9;
    a[2][0]=1;a[2][1]=-2;a[2][2]=1; a[2][3]=1;b[0]=15;
    a[3][0]=0;a[3][1]=1; a[3][2]=-3;a[3][3]=5;b[0]=12;

    for(i=0;i<4;i++)
        for(j=0;j<4;j++)
        {
            printf("\na[%d,%d] = %d ",i+1,j+1,a[i][j]);
        }
//eliminasi maju
    for(k=0;k<4-1;k++)
        for(i=k+1;i<4;i++)
        {
            factor = a[i][k] / a[k][k];
            for(j=k+1;j<4;j++)
                a[i][j]=a[i][j] - factor * a[k][j];
            b[i] = b[i] - factor * b[k];
        }

//eleminasi mundur

    x[3]=b[3]/a[3][3];
    for(i=3;i>-1;i--)
    {
        sum =0;
        for(j=i+1;j<4;j++)
            sum = sum + a[i][j] * x[j];
        x[i] = (b[i]-sum)/a[i][i];
    }

    for(i=0;i<4;i++)
    {
        printf("\nx[%d] = %f ",i+1,x[i]);
    }
    getche();
    return 0;
}

BAck KEmbali uih deui