Skip to content

Instantly share code, notes, and snippets.

@0ryant
Last active August 1, 2019 15:20
Show Gist options
  • Save 0ryant/a829b42a8a0c1c111097919967ef7b70 to your computer and use it in GitHub Desktop.
Save 0ryant/a829b42a8a0c1c111097919967ef7b70 to your computer and use it in GitHub Desktop.
Java - Coding Challenge 7 - TeenNumberChecker
public class TeenNumberChecker {
public static boolean hasTeen(int a,int b,int c){
if (a >=13 && a <=19 ||
b >=13 && b <=19 ||
c >=13 && c <=19 ) {
return true;
}
return false;
// Or, this is a little more elegant :
// return isTeen(a) || isTeen(b) || isTeen(c);
}
public static boolean isTeen(int a) {
if (a <13 || a >19){
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment