0
\$\begingroup\$

Write a program that outputs 1 when the year is a leap year, otherwise 0. You can use any programming language, but use only assignments and arithmetic expressions for the calculation.

The Gregorian calender starts 1582. Example of leap years:
1000
1100
1200
1300
1400
1516
2000
2016

Examples of common years:
1517
1900
2015

The solutions in "Counting leap years" contain relational operators and conditions. These are not allowed here. The program must work correctly for all positive years.

\$\endgroup\$
  • \$\begingroup\$ just arithmetic expressions is a very minor change. \$\endgroup\$ – Sparr Feb 16 '16 at 19:04
  • \$\begingroup\$ Don't forget the program has to work for all positive years. The solutions in "Counting leap years" don't meet this requirement. \$\endgroup\$ – Günter Hofer Feb 17 '16 at 7:57

Browse other questions tagged or ask your own question.