3
- Ask for a person’s name and sex. Present at the end how many people are male and how many are female. The program terminates when user type ORDER in person name.
Can someone help me? Every time I type order in the name, it asks for the sex of the person, I need that when typing ending to appear the closing message and that do not ask the sex.
var
nome, sexo, fim: caractere
qtdh, qtdm: inteiro
inicio
qtdh <- 0
qtdm <- 0
enquanto nome <> "fim" faca
escreval("================================================")
escreval("Digite seu nome: ")
leia(nome)
escreval("================================================")
escreval("Digite seu sexo (F ou M):")
leia(sexo)
se (sexo="F") entao
qtdm <- qtdm + 1
senao
se (sexo="M") entao
qtdh <- qtdh + 1
fimse
fimse
fimenquanto
escreval("Foram digitados", qtdh, " do sexo masculino e", qtdm, " do sexo feminino")
fimalgoritmo
Aah worked out, thank you very much, only missed the """"#no > if name <> end then
– grazisousa0101
Corrected. If this answer solved your problem and there is no doubt left, mark it as correct/accepted by clicking on the " " that is next to it, which also marks your question as solved. If you still have any questions or would like further clarification, feel free to comment.
– Vitor Subhi