70.2k views
3 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;

1 Answer

6 votes

Answer:

max = x;

if (y > max) max = y;

Step-by-step explanation:

User Bishoy Hanna
by
5.3k points