SHARE
TWEET

pr8

starm100 Dec 4th, 2018 (edited) 26 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program pr8
  2. integer::i,j,m,n
  3. real::b=10**3
  4. real,dimension(:,:),allocatable::A
  5. print*, 'Input m,n'
  6. read(*,*) m,n
  7. allocate(A(1:m,1:n))
  8. do i=1,m    
  9.         write(*,'("Input row ",(I1))') i
  10.         read(*,*) A(i,:)
  11. end do
  12. do i=1,m
  13.     call check(A,i,b)
  14.     do j=1,n
  15.         write(*,'(f7.2\)') A(i,j)
  16.     end do
  17.     print*, ' '
  18. end do
  19. write(*,'(/"Ans.-",f7.2)') b  
  20. contains
  21.    
  22.     subroutine check(A,m,b) !maxval(ARRAY,[DIM=],[MASK=])-returns max value of an array
  23.     integer::i,j,m,n
  24.     real,intent(in)::A(:,:)
  25.     real::b,max
  26.     max=maxval(A(m,:))
  27.     !n=ubound(A,2)
  28.     !max=A(m,1)
  29.     !do j=2,n
  30.         !if (A(m,j)>max) then
  31.             !max=A(m,j)
  32.         !end if
  33.     !end do
  34.     if (b>max) then
  35.         b=max
  36.     end if
  37.     end subroutine
  38.    
  39. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top