How to resolve the algorithm Last Friday of each month step by step in the J programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Last Friday of each month step by step in the J programming language
Table of Contents
Problem Statement
Write a program or a script that returns the date of the last Fridays 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 Last Friday of each month step by step in the J programming language
Source code in the j programming language
require 'dates'
last_fridays=: 12 {. [: ({:/.~ }:"1)@(#~ 5 = weekday)@todate (i.366) + todayno@,&1 1
last_fridays 2012
2012 1 27
2012 2 24
2012 3 30
2012 4 27
2012 5 25
2012 6 29
2012 7 27
2012 8 31
2012 9 28
2012 10 26
2012 11 30
2012 12 28
You may also check:How to resolve the algorithm Bioinformatics/base count step by step in the Delphi programming language
You may also check:How to resolve the algorithm Greedy algorithm for Egyptian fractions step by step in the C# programming language
You may also check:How to resolve the algorithm URL encoding step by step in the Factor programming language
You may also check:How to resolve the algorithm Hostname step by step in the ooRexx programming language
You may also check:How to resolve the algorithm Sorting algorithms/Cocktail sort step by step in the Eiffel programming language