Assume that x y and z are already defined as being of type i

Assume that x, y and z are already defined as being of type int . Write a single expression that will return y if x is less than 42 and return z + 1 otherwise.

Solution

Answer: Single expression is as follows.

if(x < 42){ //if x is less than 42

return y;

}

else{ //otherwise

return z+1;

}

Assume that x, y and z are already defined as being of type int . Write a single expression that will return y if x is less than 42 and return z + 1 otherwise.S

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site