Problem
Chef is struggling to pass a certain college course.
The test has a total of question, each question carries marks for a correct answer and for an incorrect answer. Chef is a risk-averse person so he decided to attempt all the questions. It is known that Chef got questions correct and the rest of them incorrect. For Chef to pass the course he must score at least marks.
Will Chef be able to pass the exam or not?
Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, three integers .
Output Format
For each test case output "PASS"
if Chef passes the exam and "FAIL"
if Chef fails the exam.
You may print each character of the string in uppercase or lowercase (for example, the strings "pAas", "pass", "Pass" and "PASS" will all be treated as identical).
Constraints
Sample 1:
3 5 2 3 5 2 4 4 0 0
PASS FAIL FAIL
Program :
#include<stdio.h>
int main()
{
int t,n,x,p,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d %d %d",&n,&x,&p);
int m=x*3-(n-x);
if(m>=p)
printf("PASS\n");
else
printf("FAIL\n");
}
}
0 Comments