Declare double variables num1, den1, num2, and den2, and read each variable from input in that order. Find the differenc

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Declare double variables num1, den1, num2, and den2, and read each variable from input in that order. Find the differenc

Post by answerhappygod »

Declare Double Variables Num1 Den1 Num2 And Den2 And Read Each Variable From Input In That Order Find The Differenc 1
Declare Double Variables Num1 Den1 Num2 And Den2 And Read Each Variable From Input In That Order Find The Differenc 1 (81.6 KiB) Viewed 76 times
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;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply