Java > Warmup-1 > hasTeen (CodingBat Solution)

Problem:

We'll say that a number is "teen" if it is in the range 13..19 inclusive. Given 3 int values, return true if 1 or more of them are teen.

hasTeen(13, 20, 10) → true
hasTeen(20, 19, 10) → true
hasTeen(20, 10, 13) → true


Solution:

public boolean hasTeen(int a, int b, int c) {
  return ((a >=13 && a <= 19) || (b >=13 && b <= 19)|| (c >=13 && c <= 19));
}

1 comment:

  1. What a refreshing read! Your words flow like a river—sometimes calm, sometimes wild, but always carving a path straight to the reader’s curiosity. It’s rare to find content that both sparks thought and feels like a cozy conversation. Keep turning ideas into ink (or pixels). 🌿 darknet market

    ReplyDelete