0% found this document useful (0 votes)
5 views2 pages

Lecture04 Worksheet

Uploaded by

Lo Wing Pun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Lecture04 Worksheet

Uploaded by

Lo Wing Pun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MTech–Module 2: Lecture 04

Calculator Programming

1. Input 2 numbers and compare them:


CASIO fx-3650P
? → A : ? → B: A > B
CASIO fx-50FH
? → A : ? → B: A > B

Input (A ?) Input (B ?) Display


1. 1 2
2. 5 5
3. −3
3

4. −3.45 22
7

Conclusion: If A > B , then the Display will be ____


If A = B , then the Display will be ____
If A < B , then the Display will be ____

2. We can scale the displays to different values


example: (a) modify the codes to
? → A : ? → B: 2 (A > B)
then the values will be
A> B A≤ B
Display
(b) modify the codes to
? → A : ? → B: 5 (A > B) + 3
then the values will be
A> B A≤ B
Display
(c) modify the codes to
? → A : ? → B: −3 (A > B) + 1
then the values will be
A> B A≤ B
Display

1
MTech–Module 2: Lecture 04

Exercise:
(a) modify the codes such that the values will be
A> B A≤ B
Display 3 2
(b) modify the codes such that the values will be
A> B A≤ B
Display 5 10
(c) Conclusion:
If we want the values to be
A> B A≤ B
Display a b
then we have to modify our codes to be
? → A : ? → B: m (A > B) + c
where m = __________ and c = __________

3. Modify the program to use other comparison operators “=”, “ ≠ ”, “ ≥ ” etc.

You might also like