Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nazmul202101/1616a3f66d7007f46623b19ee3d34c9b to your computer and use it in GitHub Desktop.
Save nazmul202101/1616a3f66d7007f46623b19ee3d34c9b 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.
//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;
}
else{
return a+b*2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment