Computer Science, asked by bkashish442, 5 hours ago

PASSAGE
integer i = 1 // Statement 1
while (i<= 3)
{
intj // Statement 2
while (j<= i) // Statement 3
{
printj
print blank space
j =j + 1 // Statement 4
}
print end-of-line //takes the cursor to the next line
i = i +
}​

Answers

Answered by KesavanCSE
14

Answer:

statement 2 is modified

Answered by ravilaccs
13

Answer:

The rectified form of the program is given below:

int i = 1; // Statement 1

while (i<= 3)

{

int j=0;// Statement 2

while (j<= i) // Statement 3

{

print j;

print("");

j =j + 1 ;// Statement 4

}

print("\n"); //takes the cursor to the next line

i = i ++;

}​

Explanation:

Given: Piece of program

integer i = 1 // Statement 1

while (i<= 3)

{

intj // Statement 2

while (j<= i) // Statement 3

{

printj

print blank space

j =j + 1 // Statement 4

}

print end-of-line //takes the cursor to the next line

i = i +

}​

Find: Rectify the error statement and modified

Step1:

In statement 1:

  • data types are int but it has given integer
  • Semicolon is missing.

In statement 2:

int j=0;

  • In the above statement, the semicolon was missing,
  • Single space is missing between the data types and variable names.

In statement 4

j=j+1;

  • In the above statement, the semicolon was missing,
Similar questions