Computer Science, asked by maihuterimaa, 1 year ago

HOW THE OUTPUT IS 80…??¿‽


AND HOW IT WILL RUN 7TIMES?

I WANT DRY RUN... PLEASE


#java​

Attachments:

Bphariharan: wat is while(true then)
Bphariharan: while(true) wat does this statement means
Bphariharan: ya snd mw
Bphariharan: me
maihuterimaa: it's already asked by me
Bphariharan: forward it to me
maihuterimaa: ...?
maihuterimaa: see in my questions
Bphariharan: there are many Qs in today's date tell which Qs u want
maihuterimaa: which is not answered

Answers

Answered by mn121
1

when p = 200,

loop runs 1 time

if(p<100) is false

p = p-20 = 180

when p = 180,

loop runs 2 times

if(p<100) is false

p = p-20 = 160

when p = 160,

loop runs 3 times

if(p<100) is false

p = p-20 = 140

when p = 140,

loop runs 4 times

if(p<100) is false

p = p-20 = 120

when p = 120,

loop runs 5 times

if(p<100) is false

p = p-20 = 100

when p = 100,

loop runs 6 times

if(p<100) is false

p = p-20 = 80

when p = 80,

loop runs 7 times

if(p<100) is true, so the loop terminates...

so, the program runs 7 times... and the output is 80.


maihuterimaa: thanks a lot ❤
mn121: ur wlcm
mn121: please mark it as brainliest...
mn121: ^_^
maihuterimaa: hey can you answer my other questions
Similar questions