Pass the Exam CodeChef Solution

Problem – Pass the Exam CodeChef Solution

Chef appeared for an exam consisting of 3 sections. Each section is worth 100 marks.

Chef scored A marks in Section 1, B marks in section 2, and C marks in section 3.

Chef passes the exam if both of the following conditions satisfy:

  • Total score of Chef is ≥100;
  • Score of each section ≥10.

Determine whether Chef passes the exam or not.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of a single line containing 3 space-separated numbers A,B,C – Chef’s score in each of the sections.

Output Format

For each test case, output PASS if Chef passes the exam, FAIL otherwise.

Note that the output is case-insensitive i.e. PASSPasspAsS, and pass are all considered same.

Constraints

  • 1≤T≤1000
  • 0≤A,B,C≤100

Sample 1:

Input: 5
9 100 100
30 40 50
30 20 40
0 98 8
90 80 80
Output: FAIL
PASS
FAIL
FAIL
PASS

Explanation:

Test Case 1: Although Chef’s total score is 209≥100, still Chef fails the exam since his score in section 1 is <10.

Test Case 2: Chef cleared each section’s cutoff as well his total score =120≥100.

Test Case 3: Although Chef cleared each section’s cutoff but his total score is 90<100. So he fails the exam.

Test Case 4: Although Chef’s total score is 106≥100, still Chef fails the exam since his score in section 1 is <10.

Test Case 5: Chef cleared each section’s cutoff as well his total score = =250≥100.

Pass the Exam CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
    int t,a,b,c;
	cin>>t;
	while(t--){
	    cin>>a>>b>>c;
	    if(a>=10 && b>=10 &&c>=10){
	        if((a+b+c)>=100){
	            cout<<"PASS"<<endl;
	        }
	        else{
	            cout<<"FAIL"<<endl;
	        }
	    }
	    else{
	        cout<<"FAIL"<<endl;
	    }
	}
	return 0;
}

Pass the Exam CodeChef Solution in Pyth 3

t = int(input())
for i in range(t):
    a,b,c = list(map(int,input().split()))
    if(a>=10 and b>=10 and c>=10 and a+b+c>=100):
        print("pass")
    else:
        print("fail")

Pass the Exam CodeChef Solution in Java

import java.util.Scanner;
public class Main{
    public static void main (String[] args){
    Scanner sc=new Scanner(System.in);
		int T=sc.nextInt();
		for(int i=0;i<T;i++){
		    int A=sc.nextInt();
		    int B=sc.nextInt();
		    int C=sc.nextInt();
		    int total=A+B+C;
		    if(total>=100 && A>=10 && B>=10 && C>=10){
		        System.out.println("PASS");
		    }
		    else{
		        System.out.println("FAIL");
		    }
		}
    }
}
Pass the Exam CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Pass the Exam 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.