A programmer wants to make a program to print the sum of square of the first 5 whole numbers (0...4). She writes the following program:
integer i = 0 // statement 1
integer sum = 0 // statement 2
while ( i < 5 ) // statement 3
{
sum = i*i // statement 4
i = i + 1 // statement 5
}
print sum // statement 6
Is her program correct? If not, which statement will you modify to correct it?
Option 1 : No error, the program is correct.
Option 2 : Statement 1
Option 3 : Statement 4
Option 4 : statement 6
Answer: Option 3