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.

1
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: C++

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;
}

One comment

Add comment