2.
3.
4.
5
6.
•
7.
•
•
1.
12/84
Carry out a dry run
to
show the values of
all
variables
as
each line
of
fhe following
program
is
executed:
10
LET
hours
=
40.",
20
LET
rate
=
3"111
30
LET
wage
=
hours
*
rate"'l
l
40
PRINT
hours,
rate,
wage."
Write and
test
a program, similar
to
that of problem
1,
which computes the area
of a carpet which
IS
3 metres
In
width and 4 metres
in
length. Use the variable
names: width, length, area.
Re-wrlte the program
of
problem 1
so
that
It
uses two INPUT statements Instead
of
LET
statements.
Re-write the program
of
problem 1
so
that the input data
(40
and
3)
appears
in
a
DATA
statement instead of a
LET
statement.
Re-write the program of problem 2 using a different method
of
data input. Use
READ
and
DATA
If
you
originally used
LET
and vice-versa.
Bill
and Ben agree
to
have
a gamble. Each will take out of his wallet
all
the pound
notes and give them
to
the
other.
Write a program
to
simulate this entirely with
LET
and PRINT statements. Use a third person,
Sue,
to
hold
Bill's
money while
he accepts
Ben's.
Re-write
the program
of
problem 6
so
that a
DATA
statement holds
the
two numbers
to
be exchanged.
PROBLEMS
ON
CHAPTER
2
13