1
I set the function below to check if the output value is integer or real.
funcao menu_8():inteiro
var
logaritmo :real
inicio
para contador de 0 ate 12 faca
logaritmo <- ((log(i[contador])) / (log(2)))
se ((logaritmo % 2 = 0) OU (logaritmo % 2 = 1)) entao
escreva(" é Potencia de 2: ", i[contador])
fimse
fimpara
escreval(" ")
fimfuncao
If it is real, you should not display anything on the screen.
If integer, it should display a message "é potencia de 2
"
How to test if LOGARITHM is INTEGER?
would be that if it is integer then it displays on the screen the message otherwise does not display because the number is not power of two.
– AGenaro
so the topic is named Test output value to check if it is INTEGER if the test = int then prints message otherwise it does nothing!
– AGenaro
As far as I know, it is not possible to do MOD(%) in real numbers, if this is possible your algorithm already does this, because if it is real it would return a real value as a result of MOD and would not pass in the condition of SE.
– Guto