Error in Visualg in REAL variable

Asked

Viewed 488 times

2

In the algorithm below, visualg says: I expected REAL type expression. This always happens when I type 1.88 or any number with decimals in the variable (a). But the variable is not integer as you can see. How can I fix this? Thank you!

algoritmo "CALCULOIMC"
var
      M, A, IMC: Real
inicio

      Escreva("Massa (KG): ")
      Leia(M)
      Escreva ("Altura (m): ")
      Leia(A)
      IMC <- M / (A ^ 2)
      Escreval ("IMC: ", IMC)


fimalgoritmo
  • I did a test with your example and did not generate exception, maybe it is the version of visualg, see if there is an update.

  • Fabio, I had the same problem. I closed and opened Visualg and it started working again. It must be some BUG. Abs

1 answer

0

This code has no syntax errors. The code is working normally.

Possible causes of the problem:

  • any invalid character. Try copying the text from this post or simply open a new file and write;
  • your Visualg program with bug. Try reinstalling Visualg or download version 3.0.6.5, the most stable. (There is 3.0.7.0, but not recommend.)

Addendum: either use "." or "," in Visualg.

Following test in version 2.5 Teste de execução na versão 2.5 do VisualG

Following test in version 3.0.6.5 Teste de execução na versão 3.0.6.5 do VisualG

Browser other questions tagged

You are not signed in. Login or sign up in order to post.