Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. //Given two int values, return their sum. Unless the two values are the same, then return double their sum.
  2.  
  3. //sumDouble(1, 2) → 3
  4. //sumDouble(3, 2) → 5
  5. //sumDouble(2, 2) → 8
  6.  
  7. public int sumDouble(int a, int b) {
  8. if(a==b){
  9. return ((a+b)*2);
  10. }
  11. else{
  12. return a+b;
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement