I need to calculate the minimum common divisor in fortran, I did the code, but when it compiles and runs, it closes after the user types the value and I do not know what is wrong.
PROGRAM Calc
IMPLICIT NONE
REAL :: valor,contador=0, divisao
write(*,*) "Digite um valor positivo para calcular o MDC "
read(*,*) valor
do contador = 0, valor, 1
if(MOD(valor,contador)==0)then
divisao=divisao+1
endif
end do
if(divisao == 2) then
write(*,*) "O Valor digitado possui MDC"
else
write(*,*) "O valor digitado nao possui MDC"
endif
STOP
END PROGRAM Calc