C Program To Determine Weight Class of a Boxer

In boxing the weight class of a boxer is decided as per the following table. Write a C 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

Related Read:
else if statement in C
Relational Operators In C

Expected Output for the Input

User Input:
Enter boxers weight in pounds
500

Output:
Boxer is of weight class Heavyweight

Video Tutorial: C Program To Determine Weight Class of a Boxer



YouTube Link: https://www.youtube.com/watch?v=sAvmrWLplPU [Watch the Video In Full Screen.]

Source Code: C Program To Determine Weight Class of a Boxer

  1. #include < stdio.h >  
  2.   
  3. int main()  
  4. {  
  5.     int wt;  
  6.   
  7.     printf("Enter boxers weight in pounds\n");  
  8.     scanf("%d", &wt);  
  9.   
  10.     if(wt < 115)  
  11.     {  
  12.         printf("Boxer is of weight class Flyweight\n");  
  13.     }  
  14.     else if(wt >= 115 && wt <= 121)  
  15.     {  
  16.         printf("Boxer is of weight class Bantamweight\n");  
  17.     }  
  18.     else if(wt >= 122 && wt <= 153)  
  19.     {  
  20.         printf("Boxer is of weight class Featherweight\n");  
  21.     }  
  22.     else if(wt >= 154 && wt <= 189)  
  23.     {  
  24.         printf("Boxer is of weight class Middleweight\n");  
  25.     }  
  26.     else if(wt >= 190)  
  27.     {  
  28.         printf("Boxer is of weight class Heavyweight\n");  
  29.     }  
  30.   
  31.     return 0;  
  32. }  

Output 1:
Enter boxers weight in pounds
108
Boxer is of weight class Flyweight

Output 2:
Enter boxers weight in pounds
120
Boxer is of weight class Bantamweight

Output 3:
Enter boxers weight in pounds
140
Boxer is of weight class Featherweight

Output 4:
Enter boxers weight in pounds
180
Boxer is of weight class Middleweight

Output 5:
Enter boxers weight in pounds
200
Boxer is of weight class Heavyweight

boxers weight class

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert