Rich Mellor wrote:
I was just reading that 99/100 job applicants for programming jobs
apparently cannot write a short "fizzbuzz" program when given 10 minutes
to do so in an interview.
The rules are simple -
write out the values 1 to 100 on screen
If the value is divisble by 3 write 'FIZZ' after the number
If the value is divisble by 5 write 'BUZZ' after the number
If the value is divisble by 3 and 5 write 'FIZZBUZZ' after the number
Just had another look: Is this the shortest possible version?
1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod
5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z:endfor i
Thats all one line. It should result in a file of 122b including eol.
Once LOADed it expands, of course, and should parse on JS, Minerva and
SMSQ/E.
Per
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm