Program #1 Part 1
The input for program #1 is as
follows:
5 10
15 25
35 77
0 15
13 25
125 3
51 17
65 12
19 19
35 0
47 0
75 25
81 20
85 20
Each number above is a numerator and denominator you will enter these number
into your program. Your program will turn these fractions to their reduced/simplest
form. If the denominator is 0 do not return outbput for that fraction,
but print out on the screen that you entered a 0 for the denonminator.
Display the whole number as a whole number and not a fraction so then number
two would display as 2, not 2/1, fraction 125/3 will display as 41 2/3,
and 5/10 will display as 1/2.
Program #1 Part 2
This program will require you to enter two fractions separated by an arithmetic
operator ( +, -, *, /) and to perform the indicated opeartions on the two
fractions.
Use information from Part 1 to complete Part 2. Hint use the switch command
for program flow.
The input to be used is as follows:
3/4 + 5/12
7/8 + 32/10
50/5 * 24/25
19/12 / 15/2
75/20 - 45/20
5/8 * 16/25
18/7 - 36/14
100/17 + 1/2
35/6 * 6/35
22/25 - 85/20
45/60 / 55/60
320/55 / 400/500
The output will appear as follows:
3/4 + 7/8 = 1 5/8
3 1/2 * 1 3/4 = 6 1/8
Notice: the input is on the leftside of the equal sign but it is not expressed
in the same form as it was input. It is reduced to lowest terms before
being output. Results are displayed on the right side of the equal sign.
|