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
14
Answer:
statement 2 is modified
Answered by
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
English,
18 days ago
Math,
18 days ago
Math,
1 month ago
Math,
8 months ago
Social Sciences,
8 months ago