Hello Programmers In this post, you will know how to solve the Body Mass Index Codechef Solution.Body Mass Index Codechef SolutionOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.ProblemYou are given the height HH (in metres) and mass MM (in kilograms) of Chef. The Body Mass Index (BMI) of a person is computed as MH2MH2. Report the category into which Chef falls, based on his BMI:Category 1: Underweight if BMI ≤18≤18Category 2: Normal weight if BMI ∈{19∈{19, 2020,……, 24}24}Category 3: Overweight if BMI ∈{25∈{25, 2626,……, 29}29}Category 4: Obesity if BMI ≥30≥30Input:The first line of input will contain an integer, TT, which denotes the number of testcases. Then the testcases follow.Each testcase contains a single line of input, with two space separated integers, M,HM,H, which denote the mass and height of Chef respectively.Output:For each testcase, output in a single line, 1,2,31,2,3 or 44, based on the category in which Chef falls.Constraints1≤T≤2∗1041≤T≤2∗1041≤M≤1041≤M≤1041≤H≤1021≤H≤102Its guaranteed that H2H2 divides MM.Sample Input:3 72 2 80 2 120 2 Sample Output:1 2 4 Explanation:Case 1: Since MH2=7222=18MH2=7222=18, therefore person falls in category 11.Case 2: Since MH2=8022=20MH2=8022=20, therefore person falls in category 22.Case 3: Since MH2=12022=30MH2=12022=30, therefore person falls in category 44.Body Mass Index CodeChef Solution in JAVAimport java.util.*; class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int T; T = sc.nextInt(); while(T-->0){ int M=0, H=0; int BMI=0; M = sc.nextInt(); H = sc.nextInt(); BMI = M/(H*H); if(BMI<=18){ System.out.println("1"); } else if(BMI>18 && BMI<=24){ System.out.println("2"); } else if(BMI>24 && BMI<=29){ System.out.println("3"); } else{ System.out.println("4"); } } } }Body Mass Index CodeChef Solutions in CPP#include <iostream> using namespace std; int main() { // your code goes here int t; cin>>t; while(t--){ int m,h,k; cin>>m>>h; k=m/(h*h); if(k<=18){ cout<<"1\n"; } else if(k>=19 && k<=24 ){ cout<<"2\n"; } else if(k>=25 && k<=29){ cout<<"3\n"; } else if(k>=30){ cout<<"4\n"; } } return 0; }Body Mass Index CodeChef Solutions in Pythonimport math for test in range(int(input())): weight,height = list(map(int,input().split(" "))) if ((weight/(height**2)))>=30: print("4") elif ((weight/(height**2)))>=25: print("3") elif ((weight/(height**2)))>=19: print("2") elif ((weight/(height**2)))<=18: print("1")Disclaimer: The above Problem (Body Mass Index) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.Next: Chess Match Codechef Solution Post navigationWorld Record Codechef Solution Chess Match Codechef Solution