max = ((a>b)?((a>c)?a:c):((b>c)?b:c));

Here is another way

max = ((a>b)?a:b)>c?((a>b)?a:b):c;

Advertisements

Skip to content
Skip to menu
# Raja Jaganathan – Tech Eloquent

## Success is more about mindset than skill set

# Find the maximum of three integers using the ternary operator.

max = ((a>b)?((a>c)?a:c):((b>c)?b:c));

Here is another way

max = ((a>b)?a:b)>c?((a>b)?a:b):c;

Advertisements

%d bloggers like this: