What is the exact output of the following pseudocode segment?
FOR I from 1 to 4
FOR J from 1 to 4
PRINT((J-I) + "\t")
ENDFOR
PRINTLINE()
ENDFOR
Ans:
The exact output of the given pseudocode segment:
Output:
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
Explanation: first loop will run 1 to 4
Similarly second loop will run 1 to 4---> 4 times
Print statement will print value of (j -1) with space (\t)
Print line will move the cursor next line.
Thanks, have a nice day.
Get Answers For Free
Most questions answered within 1 hours.