Computer Science, asked by krazykrotux75, 7 months ago

int x= 1; y = 1;
if(n>0)
{
x= x +1;
y= y +1;
}
What will be the output of x & y , if n = 1.

Answers

Answered by anindyaadhikari13
6

Question:-

  • Write the output of the following code.

Solution:-

Given,

n=1

x=1

y=1

Now,

n>0 is true as 1>0 is true.

So,

x=x+1 or x=2

y=y+1 or y=2

Hence,

x=2

y=2

n=1.

Similar questions