Talk:leap year/de

From Free Pascal wiki
Jump to navigationJump to search

Use LeapYear instead?

Isn't it easier to use SysUtils.LeapYear:

program testleapyear;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes,
  sysutils;

var
  TestYear: integer;
begin
  Testyear:=1600;
  while TestYear<=2013 do
  begin
    if IsLeapYear(TestYear) then
      writeln(Testyear,' is a leap year.**********')
    else
      writeln(Testyear,' is not a leap year.');
    TestYear:=TestYear+39;
  end;
end.