Hourglass puzzle: Difference between revisions
Content added Content deleted
m (→{{header|Raku}}: don't worry, please consult the Julia entry) |
m (→{{header|REXX}}: changed the program to output numbers within the output text.) |
||
Line 397: | Line 397: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
{{incomplete|REXX|Output does not show numbers?}} |
|||
{{trans|Python}} |
{{trans|Python}} |
||
<lang rexx>/*REXX program determines if there is a solution to measure 9 minutes using a */ |
<lang rexx>/*REXX program determines if there is a solution to measure 9 minutes using a */ |
||
Line 415: | Line 414: | ||
say "Turn over both sandglasses (at the same time) and continue" |
say "Turn over both sandglasses (at the same time) and continue" |
||
say "flipping them each when the sandglasses individually run down" |
say "flipping them each when the sandglasses individually run down" |
||
say "until the four-minute glass is flipped |
say "until the four-minute glass is flipped " t4%4 ' times,' |
||
say "whereupon the seven-minute glass is immediately placed on its" |
say "whereupon the seven-minute glass is immediately placed on its" |
||
say "side with |
say "side with " t7_left ' minutes of sand in it.' |
||
say |
say |
||
say "You can measure 9 minutes by flipping the four-minute glass" |
say "You can measure 9 minutes by flipping the four-minute glass" |
||
Line 428: | Line 427: | ||
Turn over both sandglasses (at the same time) and continue |
Turn over both sandglasses (at the same time) and continue |
||
flipping them each when the sandglasses individually run down |
flipping them each when the sandglasses individually run down |
||
until the four-minute glass is flipped |
until the four-minute glass is flipped 4 times, |
||
whereupon the seven-minute glass is immediately placed on its |
whereupon the seven-minute glass is immediately placed on its |
||
side with |
side with 5 minutes of sand in it. |
||
You can measure 9 minutes by flipping the four-minute glass |
You can measure 9 minutes by flipping the four-minute glass |