Computer Science, asked by EzYash, 1 month ago

Write the output of the following:-
a,b=10,12
a=a*2
b=b+5
print(a,b)

Answers

Answered by anindyaadhikari13
4

\texttt{\textsf{\large{\underline{Given C{o}de}:}}}

a, b = 10, 12

a = a * 2

b = b + 5

print(a, b)

\texttt{\textsf{\large{\underline{O{u}tput}:}}}

The output for the program is:

20 17

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

  • Here, two variable named a and b are declared.
  • Variable a stores value 10 and the other stores value - 12.
  • In the second line, the value of variable a is double. '*' operator is used to perform multiplication. a * 2 = 20 and now a = a * 2 or a = 20.
  • In the third line, 5 is added to the variable b. '+' operator is used for addition and for concatenating two or more strings. b = b + 5 or b = 12 + 5 or b = 17. So, b becomes 17.
  • In the fourth line, the values of a and b are displayed on the screen.

See attachment for verification.

Attachments:
Similar questions