ARITHMETIC PRACTICE PROBLEMS
There are several different solutions per
problem!
Convert the following COMPUTE
statements into an equivalent group of ADD, SUBTRACT, MULTIPLY, and DIVIDE
statements
*********************************************************
COMPUTE Z ROUNDED = A * B / C
– D
Multiply A by B
Divide B by C giving C (or divide C into B
giving C)
Subtract D from C giving Z rounded
*********************************************************
COMPUTE K = I – ( J / L + M) / P
Divide J by L giving J
Add J to M
Divide M by P giving P
Subtract P from I giving K
*********************************************************
COMPUTE T = S ** R
(hint: needs a perform statement)
Move 2 to x
Move s to t
Perform until x > r
Compute t = t * s
Add
1 to x
End-perform
*********************************************************
Convert the following groups
of add, subtract, multiply, and/or divide statements to one COMPUTE
statement
*********************************************************
ADD A B TO D
SUBTRACT F FROM D
MULTIPLY G TIMES D GIVING H
COMPUTE H = ((A + B + D) – F) * G
*********************************************************
DIVIDE A BY B GIVING C
ADD A C TO D
DIVIDE E INTO D GIVING F
SUBTRACT G FROM F
COMPUTE F = ((A + A/B + D) / E) - G
*********************************************************
MULTIPLY A BY B ROUNDED C
ADD B C TO E F
SUBTRACT E F FROM G
CAN’T!!! i.e.
convert to ONE compute statement because of the rounded!
COMPUTE c rounded = a * b
compute g
= g - (b+c+e
+ b+c+f)
if the C was not rounded in the
first statement i.e. the multiply statement, then the C in the second compute
would be replaced by a*b
*********************************************************