EasyManua.ls Logo

Sinclair QL - Chapter 6 - Arrays and for Loops; Problems on Chapter

Sinclair QL
135 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
Loading...
PROBLEMS ON CHAPTER 5
1. Re-write the following program using lower case letters to give a better presentation. Add the
words NEW and RUN. Use line numbers and the ENTER symbol just as you would to enter and
run a program. Use REMark to give the program a name.
LET TWO$ = "TWO"
LET FOUR$ = "FOUR"
LET SIX$ = TWO$ & FOUR$
PRINT LEN(six$)
Explain how two and four can produce 7.
2. Use indenting, lower case letters, NEW, RUN, line numbers and the ENTER symbol to show how
you would actually enter and run the following program:
REPEAT LOOP
LETTER_CODE = RND(65 TO 90)
LET LETTERS$ = CHR$(LETTER_CODE)
PRINT LETTER$
IF LETTER$ = 'Z' THEN EXIT LOOP
END REPEAT LOOP
3. Re-write the following program in better style using meaningful variable names and good
presentation. Write the program as you would enter it:
LET S = O
REPeat TOTAL
LET N = RND(1 TO 6)
PRINT ! N !
LET S = S + N
IF n = 6 THEN EXIT TOTAL
END REPeat TOTAL
PRINT S
Decide what the program does and then enter and run it to check your decision.

Other manuals for Sinclair QL

Related product manuals