Jump to content

Four is magic: Difference between revisions

no edit summary
(Added python language)
No edit summary
Line 476:
 
Nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred seven is one hundred ninety-six, one hundred ninety-six is twenty-two, twenty-two is ten, ten is three, three is five, five is four, four is magic.
</pre>
 
=={{header|Ring}}==
<lang ring>
# Project : Four is magic
# Date : 2117/11/05
# Author : Gal Zsolt [~ CalmoSoft ~]
# Email : <calmosoft@gmail.com>
 
names = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
 
for n = 1 to len(names)
nlist = []
nam = names[n]
while true
if nam = "four"
see "four is magic" + nl
loop 2
ok
nr = len(nam)
str = nam + " is " + names[nr] + ", "
add(nlist, str)
nam = names[nr]
if nr = 4
exit
ok
end
for p = 1 to len(nlist)
if p = len(nlist)
see left(nlist[p], len(nlist[p]) - 2)
else
see nlist[p]
ok
next
see ", four is magic"
see nl
next
</lang>
Output:
<pre>
one is three, three is five, five is four, four is magic
two is three, three is five, five is four, four is magic
three is five, five is four, four is magic
four is magic
five is four, four is magic
six is three, three is five, five is four, four is magic
seven is five, five is four, four is magic
eight is five, five is four, four is magic
nine is four, four is magic
</pre>
 
2,468

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.