Skip to content

Instantly share code, notes, and snippets.

@loonix
Last active October 21, 2021 22:00
Show Gist options
  • Select an option

  • Save loonix/56cf46af5e7b6b18cdff95fc44ca7007 to your computer and use it in GitHub Desktop.

Select an option

Save loonix/56cf46af5e7b6b18cdff95fc44ca7007 to your computer and use it in GitHub Desktop.
[Portugol] Verificar se numero e par ou impar #portugol
// Ler um numero e escrever se o numero e par ou impar
inicio
variavel inteiro numero
variavel real quociente
variavel inteiro resto
variavel inteiro resto2
escrever "Introduza numero: "
ler numero
quociente <- numero / 2
resto <- numero % 2//resto da divisao por dois
// outra forma de criar resto
resto2 <- numero - ( quociente * 2 )
se ( resto = 0 ) entao
escrever "Par"
senao
escrever "Impar"
fimse
fim
@SK386

SK386 commented Oct 21, 2021

Copy link
Copy Markdown

obrigado, me ajudou muito.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment