- Define the following
- A variable called
sum
with the value of 0 - A for loop that iterates a variable called
i
starts with the value 0 until it reaches 100 (the variable's value is incremented by 1 each loop)- If the value of i is 50, skip increasing the value of sum by
i
- each loop, make sure to add the value of
i
to the value ofsum
- If the value of i is 50, skip increasing the value of sum by
- after the loop definition, add print statement to print the value of
sum
- What's the value of
sum
?
- What's the value of
- A variable called
Click here to view the solution.