Guest User

Untitled

a guest
Jan 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. ! compute the greatest common factor of two integers
  2. program gcf
  3. implicit none
  4. integer :: a, b, i, imin
  5. do
  6. print *, 'Enter two integers (zeros to stop)'
  7. read *, a, b
  8. if (a == 0 .and. b == 0) then
  9. exit
  10. Else
  11. imin = 0
  12. i = min(a,b)
  13. do while (i < =(a*b) .and. imin=0)
  14. if (mod(i,a) == 0
  15. If mod(i,b) == 0)
  16. imin=i
  17. i = i + 1
  18. end do
  19. print *, "Least common multiple = ", imin
  20. end if
  21. enddo
  22. end program gcf
Add Comment
Please, Sign In to add comment