How to resolve the algorithm The Twelve Days of Christmas step by step in the dc 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 dc 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 dc programming language
Source code in the dc programming language
0
d [first] r :n
d [A partridge in a pear tree.] r :g 1 +
d [second] r :n
d [Two turtle doves and] r :g 1 +
d [third] r :n
d [Three French hens,] r :g 1 +
d [fourth] r :n
d [Four calling birds,] r :g 1 +
d [fifth] r :n
d [Five gold rings,] r :g 1 +
d [sixth] r :n
d [Six geese a-laying,] r :g 1 +
d [seventh] r :n
d [Seven swans a-swimming,] r :g 1 +
d [eighth] r :n
d [Eight maids a-milking,] r :g 1 +
d [ninth] r :n
d [Nine ladies dancing,] r :g 1 +
d [tenth] r :n
d [Ten lords a-leaping,] r :g 1 +
d [eleventh] r :n
d [Eleven pipers piping,] r :g 1 +
d [twelfth] r :n
[Twelve drummers drumming,] r :g
[
d
;g n
10 P
] sp
[
d
0 r !
1 -
d
0 r !
] sr
[
[On the ] n
d ;n n
[ day of Christmas, my true love sent to me:] n
10 P
d
lr x s_
10 P
1 +
d
12 r
] sl
0 ll x
You may also check:How to resolve the algorithm 100 doors step by step in the REXX programming language
You may also check:How to resolve the algorithm Levenshtein distance step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Set of real numbers step by step in the Phix programming language
You may also check:How to resolve the algorithm Subleq step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Brazilian numbers step by step in the Sidef programming language