How to Calculate Value of Variable "fred" in For Loop?
Calculating Variable "fred" Value in For Loop
Variable "fred" started with 1: fred = 1;
The for loop runs for index values from 1 to 8 with a step of 3:
1st iteration: index = 1, fred = 1 * 1 = 1
2nd iteration: index = 4, fred = 1 * 4 = 4
3rd iteration: index = 7, fred = 4 * 7 = 28
4th iteration: index = 10, fred = 28 * 10 = 280
Therefore, after the 4th iteration, the variable "fred" equals 280.