304 North Cardinal St.
Dorchester Center, MA 02124

# Test Averages CodeChef Solution

## Problem – Test Averages CodeChef Solution

Chef has scored A,B, and C marks in 3 different subjects respectively.

Chef will fail if the average score of any two subjects is less than 35. Determine whether Chef will pass or fail.

### Input Format

• First line will contain T, number of test cases. Then the test cases follow.
• Each test case contains of a single line of input, three integers A,B,C, denoting the Chef’s score in the three subjects.

### Output Format

For each test case, if Chef will pass, print `PASS`, otherwise print `FAIL`.

You may print each character of the string in uppercase or lowercase (for example, the strings `pass``Pass``pAss`, and `PASS` will all be treated as identical).

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

### Sample 1:

``````Input: 4
23 47 52
28 36 80
0 100 0
35 35 35
Output: Pass
Fail
Fail
Pass``````

### Explanation:

Test case 1: The average of the first two subjects is 35, the average of the first and last subject is 37.5, whereas the average of the last two subjects is 49.5. Since all averages are greater than or equal to 35, Chef will pass.

Test case 2: Since the average of the first two subjects is 32 which is less than 35, Chef will fail.

Test case 3: Since the average of the first and last subjects subjects is 0 which is less than 35, Chef will fail.

Test case 4: Since the average of any two subjects is 35 which is greater than or equal to 35, Chef will pass.

## Test Averages CodeChef Solution in C++14

``````#include <iostream>
using namespace std;

int main() {
int n;
cin>>n;
while(n--)
{
float a,b,c;
cin>>a>>b>>c;
float avg1=(a+b)/2;
float avg2=(b+c)/2;
float avg3=(a+c)/2;
if(avg1>=35 && avg2>=35 && avg3>=35)
cout<<"Pass"<<endl;
else
cout<<"Fail"<<endl;
}
return 0;
}
``````

## Test Averages CodeChef Solution in Java

``````/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
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 a= sc.nextInt();
int b= sc.nextInt();
int c= sc.nextInt();
float avg1=(float)(a+b)/2;
float avg2= (float)(a+c)/2;
float avg3= (float)(b+c)/2;
if (avg1<35 || avg2<35 || avg3<35)
System.out.println("Fail");
else
System.out.println("Pass");
}
}
}
``````

## Test Averages CodeChef Solution in Pyth 3

``````T = int(input())
for i in range(T):
A,B,C = input().split(" ")
A = int(A)
B = int(B)
C = int(C)
if (A+B)/2 < 35 or (C+B)/2 < 35 or (A+C)/2 < 35:
print("FAIL")
else:
print("PASS")
``````
##### Test Averages CodeChef Solution Review:

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

Find on CodeChef

##### Conclusion:

I hope this Test Averages 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