Answer:
if ( x > y ) {
max = x;
}
else {
max = y;
}
Explanation:
Assumptions:
(i) Variables x, y and max have been defined.
(ii) Since the question does not specify what to do if x and y are equal, I have assumed no such case exists. i.e x and y are never equal.
PS : The code has been written in Java.
According to the question, the larger of variables <em>x</em> and <em>y</em> is assigned to another variable, <em>max.</em>
To check which of x and y is greater, we could use an <em>if...else</em> statement like so;
if ( x > y ) { // check if x is greater than y
max = x; // if yes, assign the value of x to max
}
else { // then y is greater
max = y; // assign the value of y to max
}