Computer Science, asked by kamalrajatjoshi94, 2 months ago

Anybody tell the answer for the attachment. Only give the explanation not the output.​

Attachments:

Answers

Answered by anindyaadhikari13
31

\texttt{\textsf{\large{\underline{Answer}:}}}

  • The final value of a is 15.

\texttt{\textsf{\large{\underline{Explanation}:}}}

⊕ The initial value of a is – 5

⊕ Condition – a must be less than 15.

⊕ a is incremented by 2.

The possible values of after each iteration are –

\boxed{\begin{array}{c|c}\tt \underline{Value\ of\ a}:&\tt \underline{Is\ a<15?}\\ \tt5&\tt true\\ \tt7&\tt true\\ \tt9&\tt true\\ \tt11&\tt true\\ \tt13&\tt true\\ \tt15&\tt false\end{array}}

⊕ Now, as soon as the value of a becomes 15, the condition becomes false. So, no more increment takes place. So, the final value of a becomes 15.

⊕ Therefore, the value of a outside the loop is – 15.

Similar questions