How to resolve the algorithm The Twelve Days of Christmas step by step in the Icon and Unicon programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm The Twelve Days of Christmas step by step in the Icon and Unicon programming language
Table of Contents
Problem Statement
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Let's start with the solution:
Step by Step solution about How to resolve the algorithm The Twelve Days of Christmas step by step in the Icon and Unicon programming language
Source code in the icon programming language
procedure main()
days := ["first","second","third","fourth","fifth","sixth","seventh",
"eighth","ninth","tenth","eleventh","twelveth"]
gifts := ["A partridge in a pear tree.", "Two turtle doves and",
"Three french hens,", "Four calling birds,",
"Five golden rings,", "Six geese a-laying,",
"Seven swans a-swimming,", "Eight maids a-milking,",
"Nine ladies dancing,", "Ten lords a-leaping,",
"Eleven pipers piping,", "Twelve drummers drumming,"]
every write("\nOn the ",days[day := 1 to 12]," day of Christmas my true love gave to me:") do
every write(" ",gifts[day to 1 by -1])
end
You may also check:How to resolve the algorithm Send email step by step in the D programming language
You may also check:How to resolve the algorithm Closest-pair problem step by step in the VBA programming language
You may also check:How to resolve the algorithm Arithmetic-geometric mean step by step in the APL programming language
You may also check:How to resolve the algorithm Loops/Nested step by step in the Ring programming language
You may also check:How to resolve the algorithm Find limit of recursion step by step in the Befunge programming language