# FORTRAN 90 L e c

```FORTRAN 90
Lecturer : Rafel Hekmat Hameed
University of Babylon
Subject : Fortran 90
College of Engineering
Year : Second B.Sc.
Mechanical Engineering Dept.
Q/GA
tƌŝƚĞ Ă ĨŽƌƚƌĂŶ ϵϬ ƉƌŽŐƌĂŵ ƚŽ ĮŶĚ ƚŚĞ ĚĞƚĞƌŵŝŶĂŶƚ ŽĨ ŵĂƚƌŝǆ ďǇ ƵƐŝŶŐ
subroutine program.
૚
૟
૚ૠ
૚૝ ૢ
૚ૢ
૞൩
૜
A=൥ ૡ
Program aa
Implicit none
;
Integer, parameter::n=3
Integer,dimension(n,2*n-1)::a
Integer::i,j,det
Call determinant(a,det)
Write(*,6) &quot;determinant=&quot;,det
6 format(3x,a,1x,i8)
;
end
subroutine determinant (a,det)
implicit none
;
integer,parameter::n=3
integer,dimension(n,2*n-1)::a
integer::i,j ,d1,d2,det
do i=1,n
;
do j=1,n-1
a(i,n+j)=a(i,j)
;
do i=1,n
d1=1;d2=1
;
enddo
;
;
enddo
do j=1,n
d1=d1*a(j,i+j-1)
;
d2=d2*a(j,2*n-i-j+1)
det=det+d1-d2
;
enddo
;
;
end
enddo
Q/GB
You have two matrices A&amp;B, A is identity matrix with shape (/3,3/) and, B is a matrix
with rank 2 and shape (/3,3/) as shown below:
૚
B=൥ૡ
૝
૟
૜
ૢ
ૠ
૞൩
૜
D0 THE FOLLOEING:
C=A+B
Construct D which is a diagonal matrix of C
Construct E which is a scalar matrix with C(1,1)
Can we say that C asymmetric matrix? Do this branch by subroutine program.
IMPLICIT NONE
INTEGER,PARAMETER::N=3
INTEGER,DIMENSION(N,N)::A,B,C,D,E,F
INTEGER::I,J
WRITE(*,7)((A(I,J),J=1,N),I=1,N)
;
WRITE(*,*)&quot;********************&quot;
WRITE(*,7)((B(I,J),J=1,N),I=1,N)
;
WRITE(*,*)&quot;********************&quot;
;
WRITE(*,*)&quot;********************&quot;
C=A+B
WRITE(*,7)((C(I,J),J=1,N),I=1,N)
DO I=1,N
DO J=1,N
IF(I==J)THEN
D(I,J)=C(I,J)
ELSE
D(I,J)=0
ENDIF ;
ENDDO
WRITE(*,7)((D(I,J),J=1,N),I=1,N)
DO I=1,N
DO J=1,N
IF(I==J)THEN
;
;
ENDDO
WRITE(*,*)&quot;********************&quot;
E(I,J)=C(1,1)
;
ELSE ;
E(I,J)=0
ENDIF
;
ENDDO
;
ENDDO
WRITE(*,7)((E(I,J),J=1,N),I=1,N)
;
WRITE(*,*)&quot;********************&quot;
CALL SY(C,F)
7 FORMAT(3(2X,I6))
END
SUBROUTINE SY(C,F)
INTEGER,PARAMETER::N=3
INTEGER,DIMENSION(N,N)::C,F
INTEGER::I,J
DO I=1,N
DO J=1,N
F(I,J)=C(I,J)
;
ENDDO
;
ENDDO
DO I=1,N
DO J=1,N
IF(F(I,J).NE.F(J,I)) EXIT
PRINT*, &quot; C is not symmetric &quot;
END
;
ENDDO
;
ENDDO
```