Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

# Lunchtime CodeChef Solution

## Problem – Lunchtime CodeChef Solution

Chef has his lunch only between 1 pm and 4 pm (both inclusive).

Given that the current time is X pm, find out whether it is lunchtime for Chef.

### Input Format

• The first line of input will contain a single integer T, the number of test cases. Then the test cases follow.
• Each test case contains a single line of input, containing one integer X.

### Output Format

For each test case, print in a single line YES if it is lunchtime for Chef. Otherwise, print NO.

You may print each character of the string in either uppercase or lowercase (for example, the strings YeS, yEs, yes and YES will all be treated as identical).

• 1≤T≤12
• 1≤X≤12

### Sample 1:

``````Input: 3
1
7
3
Output: YES
NO
YES``````

### Explanation:

Test case 1: Lunchtime is between 1 pm and 4 pm (both inclusive). Since 1 pm lies within lunchtime, the answer is YES.

Test case 2: Lunchtime is between 1 pm and 4 pm (both inclusive). Since 7 pm lies outside lunchtime, the answer is NO.

Test case 3: Lunchtime is between 1 pm and 4 pm (both inclusive). Since 3 pm lies within lunchtime, the answer is YES.

### Lunchtime CodeChef Solution in C++17

``````#include <iostream>
using namespace std;

int main() {
int t;
int x;
cin>>t;
while(t--)
{
cin>>x;
if(x>=1&&x<=4)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
``````

### Lunchtime 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 sc = new Scanner(System.in);
int t =sc.nextInt();
for (int i=0;i<t;i++){
int x = sc.nextInt();
if(1<=x && 4>=x){
System.out.println("yes");
}
else{
System.out.println("no");
}

}
}
}
``````

### Lunchtime CodeChef Solution in Pyth 3

``````t=int(input())
for i in range(t):
x=int(input())
if x in range(1,5):
print("yes")
else:
print("no")
``````
##### Lunchtime CodeChef Solution Review:

In our experience, we suggest you solve this Lunchtime 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 Lunchtime CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Lunchtime 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