Created
August 24, 2016 07:00
-
-
Save phuongtailtranminh/5fcf99cab4084d2d53bee71dbbfc21c8 to your computer and use it in GitHub Desktop.
Find the maximum number between 2 positive integers (without compare operation, ternary operation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getMax(int a, int b) { | |
return ((a + b) + abs(a - b))/2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment