program gauss_main2 integer n, np, m, mp, i parameter (np=10, mp=20) real a(np,np), b(np,mp) character*40 filename1, filename2 write (*,*)'Please tell me the dimension n of the matrix A(n,n):' read (*,*) n if (n.gt.np) stop 'n can not be larger than np' write (*,*) 'Please give the size m of the augmented b(n,m):' read (*,*) m if (m.gt.mp) stop 'm can not be larger than mp' write (*,*) 'Please give the file name that contains A :' read (*,*) filename1 write (*,*) 'Please give the file name that contains b :' read (*,*) filename2 open (unit=20, file=filename1) do i=1,n read (20,*) ( a(i,j), j=1,n ) enddo close(20) open (unit=20, file=filename2) do i=1,n read (20,*) ( b(i,j), j=1,m ) enddo close(20) call gaussj(a,n,np,b,m,mp) write(*,*) 'The inverse matrix is :' do i=1,n write (*,*) ( a(i,j), j=1,n ) enddo write (*,*) write (*,*) 'and the solution matrix is :' do i=1,n write (*,*) ( b(i,j), j=1,m ) enddo end