Page 1 of 1

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

Posted: Tue Jul 12, 2022 8:20 am
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