0
I need to calculate the Minimum common splitter in Fortran, I did the code, but when it compiles and runs, it closes after the user enters 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
Don’t forget to always indent your codes. This makes it easy to read and debug it.
– Bruno Fonseca