421,311 views
40 votes
40 votes
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.

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

User Nidia
by
2.7k points

1 Answer

6 votes
6 votes

Answer:

max = x;

if (y > max) max = y;

Step-by-step explanation:

User Ed Bishop
by
3.0k points