EasyManuals Logo

Sinclair ZX81 User Manual

Sinclair ZX81
92 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #38 background imageLoading...
Page #38 background image
(Actually we have cheated slightly here: it should really be
GOTO
21 instead of
GOTO
30. This will have
the same effect in our program.)
3. Run the program, & then type
PRINT
C
Why is the answer 6, & not 5?
[Answer: the
NEXT
statement in line 60 is executed 5 times, and each time 1 is added to C.] What
happens if you put
STEP
2 in line 20?
4. Change the third program so that instead of automatically adding five numbers, it asks you to input how
many numbers you want adding. When you run this program, what happens if you input 0, meaning that
you want no numbers adding? Why might you expect this to cause problems to the computer, even though
it is clear what you mean? (The computer has to make a search for the statement
NEXT
C, which is not
usually necessary.) In fact this has all been taken care of.
5. Try this program, to print out the numbers from 1 to 10 in reverse order.
10
FOR
N=10
TO
1
STEP
-1
20
PRINT
N
30
NEXT
N
Convert this into a program that does not use
FOR-NEXT
loops in the same way that you would convert
program 3 into program 2 (see exercise 2). Why does the negative step make is slightly different?

Other manuals for Sinclair ZX81

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair ZX81 and is the answer not in the manual?

Sinclair ZX81 Specifications

General IconGeneral
ProcessorZilog Z80A
Processor Speed3.25 MHz
ROM8 KB
InputMembrane keyboard
StorageCassette tape
Power Supply9V DC
Dimensions167 mm x 40 mm x 175 mm
Release Year1981
ManufacturerSinclair Research
Weight350 g
Operating SystemSinclair BASIC
RAM1 KB
PortsTV out, expansion port
DisplayTelevision (RF modulator output)

Related product manuals