Yes Or No In Reply To A Proposal - Sharp MZ-80A Owner's Manual

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

30
Yes or No in Reply
to
a
Proposal?
On
a sunny Sunday,
a gentleman and
a
lady sit
face
to
face
in
a
nice
coffee shop. He
is
43 years
old,
and she
is
22
years old.
Genteleman: 1 love you
at
first sight. Can you marry me?
Lady:
Yes, if
you love me so much. 1 don't
care about the age difference.
But
not
now.
You
have to wait until
my age is half of yours.
Presume his age
is A,
hers is B and the number of years she asked him
to
wait is
X. After X years,
he is A +
X
years
while she is B
+
X.
Since her age is then half
of
his, the
condition of
A +
X
=
2
(B +
X) is
required.
To solve the equa¬
tion for X, the following is obtained.
X
=
A
2B.
10 PRINT "WHAT IS
HIS AGE
?"
20 INPUT
A
30 PRINT "WHAT IS HER AGE ?"
40 INPUT B
50 X
=
A
-
2
*
B
60
PRINT "WAIT"
;
X
;
"YEARS!"
70
END
RUN
WHAT IS HIS AGE?
? 43
WHAT IS
HER AGE ?
? 22
£R
WAIT - 1
YEARS!
It
is
impossible
to wait
for
1 year. In other words, they could have been married a year ago. Asked suddenly
about a question, the
computer
may be
confused
at what variable you
are talking about. In this program, a
string
indicating inquiry contents is inserted in line numbers
10
and
30. The
string
for an answer
is also used in line number
60.
The
INPUT
method in this program can be simplified. Modify line numbers
10
and 30 as described
below,
deleting
line numbers 20 and 40
from
the
program.
10 INPUT
'WHAT
IS HIS AGE T
;
A
30 INPUT "WHAT IS HER
AGE ?"
;
B
Those that follow line number
50 are
identical to the
above program.
RUN
WHAT IS HIS AGE? 43
[CR]
WHAT IS HER
AGE? 22
|
CR.
WAIT
-
1
YEARS!

Advertisement

Table of Contents
loading

Table of Contents