---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
PROGRAM trace
IMPLICIT NONE
INTEGER::n,i,t
REAL::s
REAL,ALLOCATABLE::a(:,:)
PRINT*," input n : "
READ*,n
ALLOCATE (a(n,n))
DO t=1,n
PRINT*," input a(",t,", 1 ) to a(",t,",",n,") :"
PRINT*
READ*,a(t,:)
END DO
s=0.
DO i=1,n
s=s+a(i,i)
END DO
PRINT*," trace = ",s
PRINT*
END