Programming problems
Programming problems
1.
Defining Diagram
Input Processing Output
num 1 Read num 1, num 2 Sum
num 2 Sum = num 1 + num 2 Difference
Diff = num 1 – num 2 Product
Pro = num 1 * num 2 Quotient
Quot = num 1/ num 2
Output Sum, Difference,
Product, Quotient
IF num 2 != 0 THEN
Print “Quotient”
ELSE
Print “Zero”
Pseudocode Algorithm
Pseudocode to calculate sum, difference, product, quotient of two integer numbers
and display them
Variables: num 1, num 2, sum, difference, product, quotient
Desking checking
Data set 1 Data set 2
num 1 5 10
num 2 12 24
Expected sum 17 34
Expected difference 7 14
Expected product 60 240
Expected quotient 0.4167 0.4167
Expected quotient if num 2 != 0 “Error” “Error"
2.
Defining Diagram