Visualg - Boolean Result

1

I mounted this algorithm in Visualg:

algoritmo "semnome"
var
inicio
se 3 = "a" entao
   escreva("igual")
senao
   escreva("diferente")
FimSe
fimalgoritmo

And I did not understand, why is the condition returning true?

    
asked by anonymous 07.04.2017 / 14:41

2 answers

0

Returns "v" because you wrote your condition like this. You reversed the logic, set it to return "v" when the condition is false.

    
07.04.2017 / 15:44
0

I tested your code with some changes and other values, but the result continues to get a 'True' Boolean value and printing on the EQUAL screen: Observe ...

 algoritmo "semnome"
 var
   x: inteiro
 inicio
   x <- 8
   se x = "c" entao
      escreva("igual")
   senao
      escreva("diferente")
   fimse
fimalgoritmo

I believe it is a bug, even though the value of x is getting the value c even though the declared variable is integer.

    
25.10.2017 / 01:34