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)
Blank 1
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
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
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am