Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phuongtailtranminh/5fcf99cab4084d2d53bee71dbbfc21c8 to your computer and use it in GitHub Desktop.
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)
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