wants to make a program to print the sum of all perfect cubes, where the value of the cubes go from 0 to 100. She writes the following program:
integer i = 0, a // statement 1
integer sum = 0;
a = ( i * i * i )
while ( i < 100 ) // statement 2
{
sum = sum + a // statement 3
i = i + 1
a = ( i * i * i ) // statement 4
}
print sum
Does this program have an error? If yes, which one statement will you modify to correct the program?
Option 1 : Statement 1
Option 2 : Statement 2
Option 3 : Statement 3
Option 4 : Statement 4
Answer: Option 2