Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program pr8
- integer::i,j,m,n
- real::b=10**3
- real,dimension(:,:),allocatable::A
- print*, 'Input m,n'
- read(*,*) m,n
- allocate(A(1:m,1:n))
- do i=1,m
- write(*,'("Input row ",(I1))') i
- read(*,*) A(i,:)
- end do
- do i=1,m
- call check(A,i,b)
- do j=1,n
- write(*,'(f7.2\)') A(i,j)
- end do
- print*, ' '
- end do
- write(*,'(/"Ans.-",f7.2)') b
- contains
- subroutine check(A,m,b) !maxval(ARRAY,[DIM=],[MASK=])-returns max value of an array
- integer::i,j,m,n
- real,intent(in)::A(:,:)
- real::b,max
- max=maxval(A(m,:))
- !n=ubound(A,2)
- !max=A(m,1)
- !do j=2,n
- !if (A(m,j)>max) then
- !max=A(m,j)
- !end if
- !end do
- if (b>max) then
- b=max
- end if
- end subroutine
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement