Buscar

lista1exercicio1

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

#include <iostream>
#define ANO_SINC 1986
#define ANO_BISSEXTO 1988
using namespace std;
int calculaHalley(int);
int main()
{
 int ano;
 cin >> ano;
 cout << calculaHalley(ano) << endl;
 return 0;
}
int calculaHalley(int ano)
{
 int bissextos = ((ano - ANO_BISSEXTO) / 4) / 365;
 if (ANO_SINC - ano > 0)
 {
 return bissextos + ANO_SINC - ((ANO_SINC - ano) / 76) * 76;
 }
 else
 {
 return bissextos + ANO_SINC + 76 + ((ano - ANO_SINC) / 76) * 76;
 }
}

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando