Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
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.
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).
Input: 3
1
7
3
Output: YES
NO
YES
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.
#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;
}
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");
}
}
}
}
t=int(input())
for i in range(t):
x=int(input())
if x in range(1,5):
print("yes")
else:
print("no")
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
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 >>