Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

pls solve this question using Fortran program as soon as you can ENGR2216: FORTR

ID: 3840702 • Letter: P

Question

pls solve this question using Fortran program as soon as you can ENGR2216: FORTRAN Programming SPRING 2017 Quiz. No. 04 Time: 20 Minutes] (B) April 30, 2017 Student Name: (a) [5 Points Student No: Write a subroutine that receives two 1-D arrays A and B are integer numbers of size n that are passed from the main program and returns a third 1-D array C of size n. Each element in C shows whether an element from A can be divided by the corresponding element in B. See the example below. You are requested to write the subroutine only while the main program will be in the next Section. 10 2

Explanation / Answer

subroutine check_arr_div(arr1,arr2,arr3)
integer, intent(out) :: arr3(:)
integer, intent(in) :: arr1(:)
integer,intent(in) :: arr2(:)
integer :: n1, i,val
n1 = size(arr1)

do i = 1, n1
val = modulo(arr1(i),arr2(i))
if (val==0) then
arr3(i)=1 ! if it is divisible then 1(true)
else
arr3(i)=0 ! if not 0(false)
end if
enddo
end subroutine check_arr_div