[Year 12 SofDev] Fun with Algorithms (continued)
Mark Kelly
kel at mckinnonsc.vic.edu.au
Tue Mar 13 15:00:49 EST 2007
Following on from the huge public acclaim of Fun with Algorithms #1,
please find some more...
Some are harder than others...
Fun #1 was to round any decimal number UP to the next highest multiple
of 0.25.
Fun #2 - Convert any Roman number to decimal (e.g. MCMLXIX to 1969) -
and/or vice versa
Fun #3 - find the lowest (or greatest) common denominator of 2 integers
(or report that there is no LCD or GCD).
Fun #4 - list prime numbers up to 100
Fun #5 - simulate the display of a single-digit liquid crystal display
Assume there are 7 LCD bars like this
_
|_|
|_|
Feed it any numeral or alphabetic character in hexadecimal range (0 to
F) and it should turn on the right bars.
Fun #6 - given a price including 10% GST, give the ex-tax price and the
tax component, e.g. $10 inc = $9 ex + $1 GST.
Fun #7 - create a virtual deck of cards encoded as numbers 1 to 52.
Given any number from 1 to 52, the algorithm should return the suit and
represented by the card.
Fun #8 - create an algorithm to shuffle the virtual deck of cards
Fun #9 - create an algorithm to play naughts and crosses - it should be
unbeatable if the algorithm plays first.
--
Mark Kelly
Manager - Information Systems
McKinnon Secondary College
McKinnon Rd McKinnon 3204, Victoria, Australia
Direct line / Voicemail: 8520 9085
School Phone +613 8520 9000 << new number!
School Fax +613 9578 9253
Webmaster - http://www.mckinnonsc.vic.edu.au
IT Lecture notes: http://vceit.com
Moderator: IPM Mailing List
Doctor - We must all face reality sooner or later.
Dowd - I wrestled with reality for 35 years, doctor, and I'm happy to
say I won out over it. ('Harvey', 1950)
More information about the sofdev
mailing list