gauss.f90

I suggest you either typed  this as it appears into the compiler, or as an easier way, just copy and paste it!

Note: I do not claim the program will 100% work, but I give it my best. If it doesn't, try tweaking it yourself, or email me about it, and I'll modify and post the improved version later. Good luck!

PROGRAM GAUSS
IMPLICIT NONE
REAL :: N,NN,I,J,K,JT,KK,L,SUM

CALL GAUSSAN
END
subroutine gaussan
dimension A(4,4), X(4)
read(*,*)N
NN=N+1
read(*,*)((A(I,J), J=1,MN),I=1,N)
do 50 K=1, N-1
KK=K+1
do 40 J=KK,NN
A(K,J)=A(K,J)/A(K,K)
WRITE(6,*)K,J,A(K,J)
40 CONTINUE
DO 30 I=1,N
J=KK
IF(K-I)20,30,30
20 A(I,J)=A(I,J)-A(I,K)*A(K,J)
WRITE(6,*)I,J,A(I,J)
J=J+1
IF(J>NN)GO TO 30
GO TO 20
30 CONTINUE
50 CONTINUE
A(N,NN)=A(N,NN)/A(N,N)
L=N
X(L)=A(L,NN)
55 L=L-1
IF(L<1)GO TO 70
SUM=0.0
DO 60 JT=L+1,N
SUM=SUM+A(L,JT)*X(JT)
60 CONTINUE
X(L)=A(L,NN)-SUM
GO TO 55
WRITE(6,*)X(I)!I=1,N)
70 RETURN

END