How to find letter grade using C

Letter grade program in C is a very popular practice program for a learner. In this program we will find the letter grade of a student depending on which marks he have got in his exam.

At first we will take the obtained mark as input from the user. Then we will check that what letter grade he have got depending on the regular mark range of letter grade.

Table of letter grade program

Marks Letter grade GPA
00 - 32
F
0.00
33 - 39
D
1.00
40 - 49
C
2.00
50 - 59
B
3.00
60 - 69
A-
3.50
70 - 79
A
4.00
80 - 100
A+
5.00

C program to find letter grade

#include <stdio.h>
int main(){
    int number;
    printf("Enter your number : ");
    scanf("%d", &number);

    if(number < 0 || number > 100){
        printf("\nInvalid number.\n");

    }else if(number >= 80){
        printf("\nWow! Your grade is A+!\n");

    }else if(number >= 70){
        printf("\nYour grade is A\n");

    }else if(number >= 60){
        printf("\nYour grade is A-\n");

    }else if(number >= 50){
        printf("\nYour grade is B\n");

    }else if(number >= 40){
        printf("\nYour grade is C\n");

    }else if(number >= 33){
        printf("\nYour grade is D\n");

    }else{
        printf("\nOops! You are fail!\n");
    }

return 0;
}

Output of letter grade program:

letter grade program in c, find letter grade of students

Previous pageProgram to check vowels

Next pageLeap year program

More C programming and projects

C learning topics