program matrix_addition
integer::a(10,10),b(10,10),c(10,10),m,n
print*,"Enter the order of two matrices:"
read(*,*)m,n
print*,"Enter the matrix A:"
do i=1,m
read(*,*)(a(i,j),j=1,n)
enddo
print*,"Enter the matrix B:"
do i=1,m
read(*,*)(b(i,j),j=1,n)
enddo
!performing matrix addition
do i=1,m
do j=1,n
c(i,j)=a(i,j)+b(i,j)
enddo
enddo
print*,"The sum of two entered matrices is:"
do i=1,m
write(*,*)(c(i,j),j=1,n)
enddo
end
integer::a(10,10),b(10,10),c(10,10),m,n
print*,"Enter the order of two matrices:"
read(*,*)m,n
print*,"Enter the matrix A:"
do i=1,m
read(*,*)(a(i,j),j=1,n)
enddo
print*,"Enter the matrix B:"
do i=1,m
read(*,*)(b(i,j),j=1,n)
enddo
!performing matrix addition
do i=1,m
do j=1,n
c(i,j)=a(i,j)+b(i,j)
enddo
enddo
print*,"The sum of two entered matrices is:"
do i=1,m
write(*,*)(c(i,j),j=1,n)
enddo
end
Comments
Post a Comment