Kolejny mały urywek kodu, ten dotyczy wykrywania roku przestępnego.

Python:

def isleapyear(year):
  return (not year%4 and year%100 or not year%400)

PHP:

function is_leapYear($year)
{
  return (!($year%4) && ($year%100) || !($year%400));
}

C++:

bool isleapyear(int year)
{
  return (!(year%4) && (year%100) || !(year%400));
}


A Ty? Co o tym myślisz?

Możesz używać w komentarzach następujących znaczników:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Sblam! Antyspam