My issue
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t,x,y,a;
cin>>t>>endl;
cin>>x>>y>>a>>endl;
if(x<=a<y)
cout<<YES<<endl;
else
cout<<no<<endl;
return 0;
}
Problem Link: AGELIMIT Problem - CodeChef
@yashbagade248
I guess your if condition might be causing issues.
You should have used and relational operator to find if a is greater than or equals to x as well as being smaller than y.
The following code might help. I have used C but the logic should remain the same.
#include <stdio.h>
int main(void)
{
int t,x,y,a;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&x,&y,&a);
if((a>=x)&&(a<y)) printf("yes\n");
else printf("no\n");
}
return 0;
}