Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program main
  2. real, dimension(:,:), allocatable:: a
  3. real, dimension(:), allocatable:: b
  4. open (1, file='data.txt')
  5. open (2, file='results.txt')
  6. read (1, '<2>(2x,i5)/)'),m,n
  7. allocate(a(m,n))
  8. allocate(b(n))
  9. do i=1,m
  10. read(1,'(<n>(f5.2))'),(a(i,j),j=1,n)
  11. enddo
  12. call sublab(m,n,a,b)
  13. end
  14.  
  15. subroutine sublab(m,n,a,b)
  16. real, dimension (m,n)::a
  17. real, dimension (n)::b
  18. do i=1,n
  19. do j-1,m
  20. if (b(i)>a(i,j)) then
  21. b(i)=a(i,j)
  22. enddo
  23. write(2,'(/<n>(f4.5))'),(b(i),i=1,n)
  24. enddo
  25. end subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement