PROGRAM Gcd
   IMPLICIT NONE
   
   INTEGER  :: Num1, Num2, Num3

   WRITE(*,*) 'two positive integers, please -->'
   READ(*,*) Num1, Num2
 
   IF ( Num1 < Num2 ) THEN 
      Num3 = Num1
      Num1 = Num2
      Num2 = Num3
   END IF

   DO
      Num3 = MOD( Num1, Num2 )
      IF ( Num3 == 0 ) EXIT
      Num1 = Num2
      Num2 = Num3
   END DO

   WRITE(*,*) 'The GCD is ', Num2

END PROGRAM Gcd
