Computer Science, asked by mohantyjoshna20, 7 months ago

write the output..........​

Attachments:

Answers

Answered by anindyaadhikari13
2

\star\:\:\:\bf\large\underline\blue{Question:-}

  • Write the output of the given code.

\star\:\:\:\bf\large\underline\blue{Solution:-}

\star\:\:\:\bf\large\underline\blue{Question\:1:-}

At first, S=0 and C=5

Now,

S=S+C

Or,

S=0+5=5.

Now,

C=C+3

Or,

C=8.

Now,

C<=10 is true since 8<=10

Now, we will go to line number 30.

So,

S=S+C

Or,

S=5+8=13

Now,

C=C+3

Or,

C=8+3=11

Now, C<=10 is false.

So,

If statement will not execute.

Now, the print statement gets executed.

So,

Sum = 13.

Now, the program terminates.

\star\:\:\:\bf\large\underline\blue{Output:-}

Sum=13.

\star\:\:\:\bf\large\underline\blue{Question\:2:-}

At first,

P=1

K=9

Now, K is printed.

9 is printed.

P=P*K=9

K=K-4=5

Now,

K>=3 is true.

So, we will shift to line 30.

Again, P=P*K

=9*5=45.

K=K-4=1.

Now, if part will not execute.

So, We will print P.

45 is printed.

\star\:\:\:\bf\large\underline\blue{Output:-}

9

45

Similar questions