part1c - WRITE(*,*)"Enter integer values for Martix1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
PROGRAM part1c IMPLICIT NONE INTEGER,ALLOCATABLE::matrix1(:,:),matrix2(:,:), matrix3(:,:) INTEGER::row1,col1,row2,col2,status,i WRITE(*,*) "Enter the number of rows and columns for martix1:" READ(*,*) row1,col1 WRITE(*,*) "Enter the number of rows and columns for martix2:" READ(*,*) row2,col2 IF(col1/=row2) STOP "Row2 is NOT equal to Column1" ALLOCATE (matrix1(row1,col1),STAT=status) IF(status/=0) STOP "Error while Allocating" ALLOCATE (matrix2(row2,col2),STAT=status) IF(status/=0) STOP "Error while Allocating" ALLOCATE (matrix3(row1,col2),STAT=status) IF(status/=0) STOP "Error while Allocating"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: WRITE(*,*)"Enter integer values for Martix1 row-by-row" DO i=1,row1 READ(*,*)matrix1(i,1:col1) END DO WRITE(*,*)"Enter integer values for Martix2 row-by-row" DO i=1,row2 READ(*,*)matrix2(i,1:col2) END DO matrix3 = MATMUL(matrix1, matrix2) WRITE(*,*)"Matrix1 is:" DO i=1,row1 WRITE(*,*) matrix1(i,1:col1) END DO WRITE(*,*)"Matrix2 is:" DO i=1,row2 WRITE(*,*) matrix2(i,1:col2) END DO WRITE(*,*) "Product Matrix3 is:" DO i=1,row1 WRITE(*,*) matrix3(i,1:col2) END DO DEALLOCATE (matrix1,STAT=status) IF(status/=0)STOP "Deallocation error" END PROGRAM...
View Full Document

This note was uploaded on 07/22/2010 for the course MAE 112 taught by Professor Freeh during the Spring '10 term at North Country Community College.

Ask a homework question - tutors are online