- Engineering
- Computer Science
- what will be the values of ans x and y...
Question: what will be the values of ans x and y...
Question details
What will be the values of ans, x, and y after the following statements are executed?
int ans = 35, x = 50, y =50;
if ( x >= y)
{
ans = x + 10; x -=y;
}
else
{
ans = y + 10;
y += x;
}
int ans = 35, x = 50, y =50;
if ( x >= y)
{
ans = x + 10; x -=y;
}
else
{
ans = y + 10;
y += x;
}
a.
ans = 60, x = 50, y =100
b.
ans = 60, x =0, y =50
c.
ans = 45, x = 50, y = 0
d.
ans = 45, x = 50, y = 50
Solution by an expert tutor
