Created
December 9, 2016 19:15
-
-
Save nazmul202101/c5dca0661d3665d16168a1c7edf980cb to your computer and use it in GitHub Desktop.
Given two int values, return their sum. Unless the two values are the same, then return double their sum.
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
//Given two int values, return their sum. Unless the two values are the same, then return double their sum. | |
//sumDouble(1, 2) → 3 | |
//sumDouble(3, 2) → 5 | |
//sumDouble(2, 2) → 8 | |
public int sumDouble(int a, int b) { | |
if(a==b){ | |
return ((a+b)*2); | |
} | |
else{ | |
return a+b; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment