Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! compute the greatest common factor of two integers
- program gcf
- implicit none
- integer :: a, b, i, imin
- do
- print *, 'Enter two integers (zeros to stop)'
- read *, a, b
- if (a == 0 .and. b == 0) then
- exit
- Else
- i = min(a,b);
- do while (i < =(a*b) .and. imin=0)
- if (mod(i,a) == 0
- If mod(i,b) == 0)
- imin=i
- i = i + 1
- end do
- print *, "Least common multiple = ", imin
- end if
- enddo
- end program gcf
Add Comment
Please, Sign In to add comment