How to resolve the algorithm Day of the week step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Day of the week step by step in the Quackery programming language

Table of Contents

Problem Statement

A company decides that whenever Xmas falls on a Sunday they will give their workers all extra paid holidays so that, together with any public holidays, workers will not have to work the following week (between the 25th of December and the first of January).

In what years between 2008 and 2121 will the 25th of December be a Sunday? Using any standard date handling libraries of your programming language; compare the dates calculated with the output of other languages to discover any anomalies in the handling of dates which may be due to, for example, overflow in types used to represent dates/times similar to   y2k   type problems.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Day of the week step by step in the Quackery programming language

Source code in the quackery programming language

  [ over 3 < if [ 1 - ]
    dup 4 / over +
    over 100 / -
    swap 400 / +
    swap 1 - 
    [ table 
      0 3 2 5 0 3
      5 1 4 6 2 4 ]
    + + 7 mod ]         is dayofweek ( day month year --> weekday )

say "The 25th of December is a Sunday in: " cr
2121 1+ 2008 - times 
  [ 25 12 i^ 2008 + dayofweek
    0 = if [ i^ 2008 + echo sp ] ]

  

You may also check:How to resolve the algorithm Cyclops numbers step by step in the Python programming language
You may also check:How to resolve the algorithm Magic 8-ball step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Multifactorial step by step in the Tcl programming language
You may also check:How to resolve the algorithm HTTP step by step in the 8th programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the 360 Assembly programming language