How to resolve the algorithm Long year step by step in the Draco programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Long year step by step in the Draco programming language

Table of Contents

Problem Statement

Most years have 52 weeks, some have 53, according to ISO8601.

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Long year step by step in the Draco programming language

Source code in the draco programming language

proc p(word y) word:
    (y + y/4 - y/100 + y/400) % 7
corp

proc longyear(word y) bool:
    p(y) = 4 or p(y-1) = 3
corp

proc main() void:
    word y;
    for y from 2000 upto 2100 do
        if longyear(y) then writeln(y) fi
    od
corp

  

You may also check:How to resolve the algorithm Equal prime and composite sums step by step in the Sidef programming language
You may also check:How to resolve the algorithm Pi step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Arithmetic derivative step by step in the Python programming language
You may also check:How to resolve the algorithm Honaker primes step by step in the Raku programming language
You may also check:How to resolve the algorithm Pi step by step in the Visual Basic .NET programming language