Question & Answer: solve this fortran program clearly…..

ID: (e) 15 MARKS]. Write a subroutine that receives from the main program two 2-dimensional arrays A and B each of size m by n. The subroutine creates array C which includes the elements of arrays A and B as shown in the example below. Section: Example: 4 41 B=15 51; 1 1 4 4 C-[A B-12 2 55 3366 A-12 21: Your subroutine must be general (i.e. it can be used for any values of m and n) Do not write the main program).

solve this fortran program clearly

ID: (e) 15 MARKS]. Write a subroutine that receives from the main program two 2-dimensional arrays A and B each of size m by n. The subroutine creates array C which includes the elements of arrays A and B as shown in the example below. Section: Example: 4 41 B=15 51; 1 1 4 4 C-[A B-12 2 55 3366 A-12 21: Your subroutine must be general (i.e. it can be used for any values of m and n) Do not write the main program).

Expert Answer

 

Subroutine to create Array C which Includes Array A and Array B

subroutine carray(a,b)
integer dim1,dim2,elements

elements = size(a) 
dim1=size(a,DIM=1)

dim2=elements/dim1

INTEGER, DIMENSION(dim1,2*dim2) :: C
do i=0,dim1
do j=0,dim2
C(i,j) = a(i,j)
C(i,j+dim2) = b(i,j)
enddo
enddo
Still stressed from student homework?
Get quality assistance from academic writers!