How to resolve the algorithm Find the last Sunday of each month step by step in the PicoLisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Find the last Sunday of each month step by step in the PicoLisp programming language
Table of Contents
Problem Statement
Write a program or a script that returns the last Sundays of each month of a given year. The year may be given through any simple input method in your language (command line, std in, etc). Example of an expected output:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Find the last Sunday of each month step by step in the PicoLisp programming language
Source code in the picolisp programming language
(de lastSundays (Y)
(for M 12
(prinl
(dat$
(find '((D) (= "Sunday" (day D)))
(mapcar '((D) (date Y M D)) `(range 31 22)) )
"-" ) ) ) )
: (lastSundays 2013)
2013-01-27
2013-02-24
2013-03-31
2013-04-28
2013-05-26
2013-06-30
2013-07-28
2013-08-25
2013-09-29
2013-10-27
2013-11-24
2013-12-29
You may also check:How to resolve the algorithm Find limit of recursion step by step in the Déjà Vu programming language
You may also check:How to resolve the algorithm Chernick's Carmichael numbers step by step in the F# programming language
You may also check:How to resolve the algorithm Unix/ls step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Averages/Pythagorean means step by step in the Go programming language
You may also check:How to resolve the algorithm Here document step by step in the Yabasic programming language