0
I’m doing a program at a school where the program should ask how many students, right after offering a "registration" for each student stating their name and grade. In the case of this code, when the program asks to read the note, it gives an error saying that the variable "note" was not declared to be the real type, but it was.
Follow the full code:
algoritmo "Escola"
// Função :
// Autor :
// Data : 13/01/2021
// Seção de Declarações
var
NA, N, QA: Inteiro
maior, nota: Real
nome, MelhorAluno: Caractere
inicio
Escreval ("--------------------------------")
Escreval ("--- ESCOLA SANTA PACIENCIA ---")
Escreval ("--------------------------------")
Escreval
Escreval ("--------------------------------")
Escreva ("Quantos alunos a turma tem? ")
Leia (NA)
Escreval("---------------------------------")
Enquanto (N <= NA) faca
QA <- QA + 1
Escreval ("ALUNO", QA)
Escreva ("Nome do aluno: ")
Leia (nome)
Escreva ("Nota de ", nome, ": ")
Leia (nota)
Escreval ("---------------------------------")
Se (nota > maior) entao
maior <- nota
nome <- MelhorAluno
FimSe
FimEnquanto
Escreval
Escreval ("O aluno ", MelhorALuno, " foi o aluno que teve o maior aproveitamento.")
fimalgoritmo
You use the variables
N,QAandmaiorwithout having assigned any value to them. As you do not change the value ofNyour testEnquanto (N <= NA) facacan stay true forever (infinite loop). What you are reporting when you ask fornota?– anonimo