Example 16: Determine the Weight Class of a Boxer

You will learn how to determine the weight class of a boxer using multiple if conditions.

Problem

In boxing, the weight class of a boxer is decided as per the following table. Write a program that receives weight as input and prints out the boxer’s weight class.

Boxer Class Weight in Pounds
Flyweight < 115
Bantamweight 115 – 121
Featherweight 122 – 153
Middleweight 154 – 189
Heavyweight >= 190

Example

Input Output
75 Flyweight
119 Bantamweight
130 Featherweight
170 Middleweight
200 Heavyweight
-76 Invalid Input

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.