Computer Science, asked by helpw684, 3 months ago

what will be the output for the following expression? where a=2 and b=4. (++a) + (++b)=?​

Answers

Answered by anindyaadhikari13
9

Required Answer:-

Given:

\dag\ \large\begin{cases}\tt a=2\\ \tt b=4\end{cases}

To Find:

  • The output of the expression - (++a) + (++b)

Solution:

Given,

\tt >> a=2

\tt>>b=4

So,

\tt (++a)+(++b)

\tt= 3+(++b)\ \ \{a\ becomes\ 3,\:pre-increment\}

\tt= 3+5\ \ \{b\ becomes\ 5,\:pre-increment\}

\tt = 8

Hence, the output of the given expression will be - 8.

Answer:

  • Output - 8.
Answered by BrainlyProgrammer
4

Given:

  • a=2, b=4

To find:

  • ++a + ++b=?

Calculating...

 \large  \blue{+  + a  \:  \: +  \:  \:  +  + b  }\\  \green{: \implies \:  +  + 2 \:  \:  +  \:  \:  +  + 4}\\ \orange{: \implies \:  3 \:  \:  +  \:  \:  5} \\ \red{: \implies  \orange{  \underbrace{\underline{ \:  \:  \underline{\boxed{ \bold{8}}} \:  \:}}}}

Correct Answer:-

\large{\orange{: \implies   \underbrace{ \overbrace \bold{ \underline{ \boxed{ \underline{ \bold{ \:  \: 8 \:  \: }}}}}}}}

Always Remember:-

  • ++a or --a is a prefix increment decrement operator respectively which means first increase then move forward.
  • a++ or a-- is a postfix increment decrement operator respectively which means first move forward then increase the value.
Similar questions