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.43 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. i = min(a,b);
  12. do while (i < =(a*b) .and. imin=0)
  13. if (mod(i,a) == 0
  14. If mod(i,b) == 0)
  15. imin=i
  16. i = i + 1
  17. end do
  18. print *, "Least common multiple = ", imin
  19. end if
  20. enddo
  21. end program gcf
Add Comment
Please, Sign In to add comment