Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Battery Low CodeChef Solution

Problem – Battery Low CodeChef Solution

Chef’s phone shows a Battery Low notification if the battery level is 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 Yes, if the battery level is 15% or below. Otherwise, print No.

You may print each character of Yes and No in uppercase or lowercase (for example, YeS, YES, yes will be considered identical).

Constraints

  • 1≤T≤100
  • 1≤X≤100

Subtasks

Subtask #1 (100 points): original constraints

Sample 1:

Input: 3
15
3
65
Output: Yes
Yes
No

Explanation:

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

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

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

Battery Low CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    int x;
	    cin >> x;
	    if(x>15)
	    {
	        cout << "No" << endl;
	    }
	    else
	    cout<<"Yes"<<endl;
	}
	return 0;
}

Battery Low CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
			Scanner scn= new Scanner(System.in);    //System.in is a standard input stream  
        int T= scn.nextInt();
        
       for(int i=0; i<T; i++){
        int X= scn.nextInt();
       
        if(X<=15){
        
        System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
       }
	}
}

Battery Low CodeChef Solution in Pyth 3

T = int(input())
for i in range(T):
    X =int(input())
    if X<=15:
        print("Yes")
    else:
        print("No")
Battery Low CodeChef Solution Review:

In our experience, we suggest you solve this Battery Low CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Battery Low CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Battery Low CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

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