How to resolve the algorithm Leap year step by step in the Oberon-2 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Leap year step by step in the Oberon-2 programming language

Table of Contents

Problem Statement

Determine whether a given year is a leap year in the Gregorian calendar.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Leap year step by step in the Oberon-2 programming language

Source code in the oberon-2 programming language

PROCEDURE IsLeapYear(year: INTEGER): BOOLEAN;
BEGIN
  IF year MOD 4 # 0 THEN 
    RETURN FALSE
  ELSE 
    IF year MOD 100 = 0 THEN
      IF year MOD 400  = 0 THEN
	RETURN TRUE
      ELSE 
	RETURN FALSE
      END
    ELSE
      RETURN TRUE
    END
 END
END IsLeapYear;

  

You may also check:How to resolve the algorithm Atomic updates step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Literals/Integer step by step in the Delphi programming language
You may also check:How to resolve the algorithm Arrays step by step in the Mercury programming language
You may also check:How to resolve the algorithm Weird numbers step by step in the Raku programming language
You may also check:How to resolve the algorithm String comparison step by step in the Standard ML programming language