Computer Science, asked by anikaekgupta, 4 months ago

Output of this code.
int a=12;a++; system.out.println(a);
a-=a—+—a; system.out.println(a);

Answers

Answered by anindyaadhikari13
3

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

  • Write the output of the following code.

\star\:\:\:\sf\large\underline\blue{Answer:-}

Given code,

int a=12;

a++;

System.out.println(a);

a-=a-- + --a;

System.out.println(a);

At first,

a=12,

a++

So, a=13 now.

Therefore, 13 is printed.

Now,

a-=a-- + --a

Or,

a=13-(13+11)

Or,

a=-11

Therefore, -11 is printed.

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

13

-11

Similar questions