Skip to content

Instantly share code, notes, and snippets.

@samueltcsantos
Created February 18, 2015 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueltcsantos/1ea789bffa3f31293276 to your computer and use it in GitHub Desktop.
Save samueltcsantos/1ea789bffa3f31293276 to your computer and use it in GitHub Desktop.
Funcao para verificar se um ano é bissexto.
algoritmo "funcaoBissexto"
// Função : Bissexto - Um ano é bissexto se ele for divisível por 400 ou se ele
// for divisível por 4 e não por 100.
// Bissexto: 1980, 1984, 1988, 1992, 1996 e 2000.
// 1900 não foi bissexto, mas 1600 foi
// Autor : Samuel T. C. Santos
// Data : 18/02/2015
// Seção de Declarações
var
ano : inteiro
funcao bissexto(ano : inteiro) : logico
inicio
retorne (ano mod 400 = 0) ou ((ano mod 4 = 0) e (ano mod 100 <> 0))
fimfuncao
inicio
// Seção de Comandos
escreva("Ano? ")
leia(ano)
se (bissexto(ano)) entao
escreval(ano, " é bisexto!")
senao
escreval(ano, " nao é bissexto!")
fimse
fimalgoritmo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment