This program should:Reads from the first line of the entry the number N of the operations to be performed.Reads from each of the following N lines the data for the execution of an operation, ie:- the...

This program should:Reads from the first line of the entry the number N of the operations to be performed.Reads from each of the following N lines the data for the execution of an operation, ie:- the symbol of the operation (one character from +, -, *, /)- the numerator and denominator of the first fraction- the numerator and denominator of the second fractionChecks the data entered to ensure their validity, ie:The denominators of the fractions must not be zero- in division, the numerator of the second fraction must not be zero- if the above does not apply, print the word "error" instead of the result of the operationPrints in turn the result of each of the N operations, one on each output line. Theresult of each operation must be displayed in the form of a mixed number with a simplified fraction.If the integer part is 0 it should be written. The three numbers (the whole part, the numeratorand the denominator) must be separated by a space. Look carefully at everythingthe following examples.Your program does not need to read all input lines first and thenprints all results together. It can print the result of each operation as soon asread.EXAMPLE;INPUT:5+ 1 3 1 4* 2 3 12 7/ 3 8 -2 11- 1 3 4 6- 2 3 4 6
OUTPUT0 7 121 1 7-2 1 16-0 1 30 0 1
Oct 31, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here