FIZZBUZZ

Discussion about ZX80 / ZX81 Software
User avatar
Paul
Posts: 1517
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: FIZZBUZZ

Post by Paul »

I just checked that an empty 1K program with a name of 1 Character takes 143 Bytes in a .P file.

With some help of Dr. Beep I reduced the code a bit more:

The length of the .P file is now 271 bytes. Minus the 143 is 128 bytes in total with variables... a magic number :)
We have to go for 64 Bytes now!
Attachments
fizz1k_5.P
(271 Bytes) Downloaded 174 times
f1k5.JPG
f1k5.JPG (4.68 KiB) Viewed 3228 times
In theory, there is no difference between theory and practice. But, in practice, there is.
dr beep
Posts: 2077
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: FIZZBUZZ

Post by dr beep »

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

No word about STOP after program, only 100 numbers to the screen.

100 PRINT A;"FIZZ" AND A/INT PI=INT (A/INT PI);"BUZZ" AND A/B=INT (A/B);" ";
101 LET A=A+SGN PI
102 GOTO A

A starts with 1
Post Reply