Press "Enter" to skip to content

Calculate Student Grade in C

To calculate grade of a student on the basis of his total marks in C programming, you have to ask to the user to enter marks obtained.After checking  the conditions the result will be shown in windrow. Then user can see the result.

C Programming Code to Calculate Grade of Student

#include <stdio.h>
void main()
{
int marks;
printf("\nEnter your marks :");
scanf ("%d", &marks);

if ((marks <= 100) && (marks >= 90))
{
printf("\nYour grade is A.\n");
}

else if ((marks < 90) && (marks >= 80))
{
printf("\nYour grade is B.\n");
}
else if ((marks < 80) && (marks >= 70))
{
printf("\nYour grade is C.\n");
}
else if ((marks < 70) && (marks >= 60))
{
printf("\nYour grade is D.\n");
}
else
{
printf("\nYour grade is F.\n");
}
}

After run the program output looks like

Be First to Comment

Leave a Reply

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