Age Limit CodeChef Solution

Problem – Age Limit CodeChef Solution

Chef wants to appear in a competitive exam. To take the exam, there are following requirements:

  • Minimum age limit is XX (i.e. Age should be greater than or equal to XX).
  • Age should be strictly less than YY.

Chef’s current Age is AA. Find whether he is currently eligible to take the exam or not.

Input Format

  • First line will contain TT, number of test cases. Then the test cases follow.
  • Each test case consists of a single line of input, containing three integers X, Y,X,Y, and AA as mentioned in the statement.

Output Format

For each test case, output YES if Chef is eligible to give the exam, NO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings YESyEsyes, and yeS will all be treated as identical).

Constraints

  • 1 \leq T \leq 10001≤T≤1000
  • 20 \leq X \lt Y \leq 4020≤X<Y≤40
  • 10 \leq A \leq 5010≤A≤50

Sample 1:

Input:
5
21 34 30
25 31 31
22 29 25
20 40 15
28 29 28

Output:
YES
NO
YES
NO
YES

Explanation:

Test case 1: The age of Chef is 3030. His age satisfies the minimum age limit as 30 \ge 2130≥21. Also, it is less than the upper limit as 30 \lt 3430<34. Thus, Chef is eligible to take the exam.

Test case 2: The age of Chef is 3131. His age satisfies the minimum age limit as 31 \ge 2531≥25. But, it is not less than the upper limit as 31 \nless 3131≮31. Thus, Chef is not eligible to take the exam.

Test case 3: The age of Chef is 2525. His age satisfies the minimum age limit as 25 \ge 2225≥22. Also, it is less than the upper limit as 25 \lt 2925<29. Thus, Chef is eligible to take the exam.

Test case 4: The age of Chef is 1515. His age does not satisfy the minimum age limit as 15 \lt 2015<20. Thus, Chef is not eligible to take the exam.

Age Limit CodeChef Solution in C++17

#include <iostream>
using namespace std;

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

Age Limit CodeChef Solution in Python3

t=int(input())
for i in range(t):
    x,y,a=map(int,input().split())
    if a>=x and a<y:print("Yes")
    else: print ("No")

Age Limit 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();
		while(t-- > 0)
		{
		    int x = sc.nextInt();
		    int y =sc.nextInt();
		    int a=sc.nextInt();
		    if(a>=x && a<y)
		    {
		        System.out.println("yes");
		    }
		    else
		    {
		        System.out.println("no");
		    }
		}
	}
}
Age Limit CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Age Limit 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.