Question: 4. (30 points) Rewrite the following code fragment using a do-while loop with no decisions in the loop body. Assume that all variables have been
4. (30 points) Rewrite the following code fragment using a do-while loop with no decisions in the loop body. Assume that all variables have been declared. sum = 0; for (odd = 1; odd < n; odd = odd + 2) sum = sum + odd; printf("Sum of the positive odd numbers less than %d is %d ",n, sum); In what situation, will the rewritten code print an incorrect sum?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
