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 https://www.youtube.com/watch?v=sAvmrWLplPU]

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

#include < stdio.h >

int main()
{
    int wt;

    printf("Enter boxers weight in pounds\n");
    scanf("%d", &wt);

    if(wt < 115)
    {
        printf("Boxer is of weight class Flyweight\n");
    }
    else if(wt >= 115 && wt <= 121)
    {
        printf("Boxer is of weight class Bantamweight\n");
    }
    else if(wt >= 122 && wt <= 153)
    {
        printf("Boxer is of weight class Featherweight\n");
    }
    else if(wt >= 154 && wt <= 189)
    {
        printf("Boxer is of weight class Middleweight\n");
    }
    else if(wt >= 190)
    {
        printf("Boxer is of weight class Heavyweight\n");
    }

    return 0;
}

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

Leave a Reply

Your email address will not be published. Required fields are marked *