Created
February 18, 2015 12:30
-
-
Save samueltcsantos/1ea789bffa3f31293276 to your computer and use it in GitHub Desktop.
Funcao para verificar se um ano é bissexto.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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