Sei sulla pagina 1di 1

c

4
3

Program for Addition of two matrices


dimension A(10, 10), b(10, 10), c(10, 10)
integer row, col
write(*,*) ' feed no. of rows and columns'
read(*,*) row,col
write(*,*) ' feed the matrix A row-wise'
do 1 I=1, row
read(*,*)(A(I,J),J=1,col)
continue
write(*,*)'feed the matrix B row-wise'
do 2 I=1, row
read(*,*) (B(I,J), J=1, col)
continue
do 3 I=1 , row
do 4 J=1, col
c(I,J)=A (I,J)+ B(I,J)
continue
continue
write(*,*) ' sum of matrices is = '
do 5 I=1, row
write(*,*) (c(I,J), J=1, col)
continue
stop
end
Result
feed no. of rows and columns
22
feed the matrix A row-wise
56
78
feed the matrix B row-wise
45
65
sum of matrices is =
9. 11.
13. 13.

Potrebbero piacerti anche