Given the following code: double sum = 0.0; double i = 0.0; while(i != 10.0) { sum += i; i += (1.0/3); } a. What is wron

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

Given the following code: double sum = 0.0; double i = 0.0; while(i != 10.0) { sum += i; i += (1.0/3); } a. What is wron

Post by answerhappygod »

Given the following code:
double sum = 0.0;
double i = 0.0;
while(i != 10.0) {
sum += i;
i += (1.0/3);
}
a. What is wrong with this code? (5 points)
You have to put this code in main(), and also you have toinclude header file.
b. Why is this a problem? (5 points)
Blank 2
c. Rewrite the code to fix the problem and return the expectedvalue of ‘sum’. (5 points)
Blank 3
in java
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply