Given the integer variables x and y, write a fragment of code that assigns the larger of x and y to another integer variable max.

LANGUAGE: Java

CHALLENGE:

Given the integer variables x and y, write a fragment of code that assigns the larger of x and y to another integer variable max.

SOLUTION:

if(x>y)
{
max = x;
}
else
{
max = y;
}

[/sourcecode]