wants to print the following pattern on the screen:
1
1 2
1 2 3
He writes the following program:
integer i = 1 // statement 1
while ( i <= 3 )
{
int j // Statement 2
while ( j <= i ) // Statement 3
{
print j
print blank space
j = j + 1 // Statement 4
}
print end-of-line \takes the cursor to the next line
i = i + 1
}
Will this program function correctly? If not which one statement will you modify to
make the program function correctly?
Option 1 : Statement 1
Option 2 : Statement 2
Option 3 : Statement 3
Option 4 : Statement 4
Option 5 : Program does not have error.
Answer: Option 2