Computer Science, asked by sujatakumaridolly, 11 months ago

Consider the following code fragment:
n = 3
while n == 3
Print n
n = n - 1
A) what will be the output of above code?
B) what is the reason behind this output?
C) what change/ correction will you make to above code to make it print some output?

Answers

Answered by deepak97395
0

Answer:

output = 3

Explanation:

it will print n (written in line 3)

but when it go to line 4, it assign a new value to n which is = n-1 which means now n = 2 (3-1)

now n not equal to 3 then it will no longer go through while loop

as given condition is false

Similar questions