Problem with Conditional Structure If and Otherwise

Asked

Viewed 49 times

-1

I would like to know why the program does not display the Student Performance :

   Escreva("Digite a primeira nota: ")
   Leia(nota1)
   Escreva("Digite a segunda nota: ")
   Leia(nota2)
   media <- (nota1 + nota2) / 2
   Escreval("Media : ",media)

   Se (media >= 10) e (media < 9) entao
      Escreval(" Aproveitamento : A")
   Senao
        Se (media >= 9) e (media < 8) entao
             Escreval("Aproveitamento : B")
        Senao
             Se (media >= 8) e (media < 7) entao
                Escreval("Aproveitamento : C")
             Senao
                  Se (media >= 7) e (media < 6) entao
                    Escreval("Aproveitamento : D")
                  Senao
                       Se (media >= 6) e (media < 5) entao
                           Escreval("Aproveitamento : E")
                       Senao
                            Se (media < 5) entao
                               Escreval("Aproveitamento : F")
                            FimSe
                       FimSe
                  FimSe
             FimSe
        FimSe
   FimSe

fimalgoritmo
  • What error you are facing?

  • The program does not display the student’s Performance.

1 answer

0


Its logic is reversed, check the signs of higher " > "and lower " < ", the way it is does not satisfy any condition.

  • Thank you very much, had not noticed this problem and now that I invert the code works normally!!

Browser other questions tagged

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