Declare double variables num1, den1, num2, and den2, and read each variable from input in that order. Find the differenc
Posted: Sun Jul 10, 2022 11:26 am
Declare double variables num1, den1, num2, and den2, and read each variable from input in that order. Find the difference of the fractions num1/den1 and num2/den2 and assign the result to fraction Difference. The calculation is: difference = num1 den₁ Ex: If the input is 1.5 3.5 4.0 4.5, the output is: -0.46 Note: Assume that den1 and den2 will not be 0. 5 int main() { 6 7 double num1; 8 double den1; 9 double num2; double den2; 10 11 12 13 14 15 16 17 18 19 num2 den2 double fractionDifference; cin >> num1; cin >> den1; cin >> num2; cin >> den2; fractionDifference = (num1/den1) - (num2-den1); cout << fixed << setprecision (2) << fractionDifference << endl;