Tony Firshman wrote:
Marcel Kilgus wrote, on 26/Nov/10 17:02 | Nov26:
Marcel Kilgus wrote:
1for i=1to 100
2a$="":if i mod 3=0:a$="FIZZ"
3if i mod 5=0:a$=a$&"BUZZ"
4print i,a$:next i
(91 bytes including 4 LF)
Damn, missed something:
1for i=1to 100
2a$="":if i mod 3=0:a$="FIZZ"
3if i mod 5=0:a$=a$&"BUZZ"
4print i,a$:next
(89 bytes including 4 LF)
1i=i+1
2a$="":if i mod 3=0:a$="FIZZ"
3if i mod 5=0:a$=a$&"BUZZ"
4print i,a$:goto 1
82 bytes incl LF
and CTRL SPACE after 100.
This meets all Rich's requirements:
----------
The rules are simple -
write out the values 1 to 100 on screen
If the value is divisible by 3 write 'FIZZ' after the number
If the value is divisible by 5 write 'BUZZ' after the number
If the value is divisible by 3 and 5 write 'FIZZBUZZ' after the number
----------
Nothing about having to stop at 100 (8-)#
Tony
1PRINT CHR$(RND(TO 255)):GO TO 1
(It might take a little while...)
--
Lau AS! d-(!) a++ c++++ p++ t+ f-- e++ h+ r--(+) n++(*) i++ P- m++
ASC Decoder at<http://www32.brinkster.com/ascdecode/>
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm