O – Battery Low

Chef’s phone shows a Battery Low notification if the battery level is 15%15% or less.

Given that the battery level of Chef’s phone is 𝑋%X%, determine whether it would show a Battery low notification.

Input Format

  • First line will contain 𝑇T, number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, an integer 𝑋X, denoting the battery level of the phone.

Output Format

For each test case, output in a single line YesYes, if the battery level is 15%15% or below. Otherwise, print NoNo.

You may print each character of YesYes and NoNo in uppercase or lowercase (for example, YeSYeS, YESYES, yesyes will be considered identical).

Constraints

  • 1≤𝑇≤1001≤T≤100
  • 1≤𝑋≤1001≤X≤100

Subtasks

Subtask #1 (100 points): original constraints

Sample 1

InputcopyOutputcopy
3
15
3
65
Yes
Yes
No

Test Case 1: The battery level is 1515. Thus, it would show a battery low notification.

Test Case 2: The battery level is 33, which is less than 1515. Thus, it would show a battery low notification.

Test Case 3: The battery level is 6565, which is greater than 1515. Thus, it would not show a battery low notification.

Solutions:

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int X = scanner.nextInt();
            if (X <= 15) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
        scanner.close();
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top