Computer Science, asked by plegend944, 7 months ago

b) What will be the output of the following code?
int a=5;
int b=16:
if(a>b)
a++;
--b:
System.out.println(“a=" +a);
System.out.println(“b=" +b);​

Answers

Answered by anindyaadhikari13
1

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

  • Write the output of the following code.

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

Given that,

int a=5;

int b=16;

Now, a>b is false since 5 is less than 16.

So, if part will not execute.

Now, --b = 15;

and a=5 only.

Now, we will print the value of a

a=5

b=15.

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

a=5

b=15

Similar questions