C Program For Find A Grade Of Given Marks Using Switch Case

Problem:- Finding grade of a student in C program using if else condition or C Switch case statement in C programming language with sample c programs. The syntax of Switch Statement. Control flow diagram of swith case statement. Important Points about Switch. Advantage and disadvantage of switch case. default case and break statement. C program to show use of switch case or Program to Calculate Grade of Student or C Program to Calculate Grade of Student or C Program To Find Grades Of A Student Using Else If Ladder or c program to find grade of a student using switch.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

Logic:- Logic is very simple for grade program in C using a switch case. Taking an input from the user(Input should be between range given 0 to 100 Else program play with you), as we know that grading system so divides the Mark by 10 and put the case condition in program See the below Explanation Step by step for better understanding.

Explanation:- So first divide the mark by 10 so we can get a reminder and as you can see in the program we use case 4 to case 10. So if the remainder is between 4 to 10 our case perform the particular grade operation and display the result See the Step By Step Example for each case may be in this grade problem.


Case 1:- If the user is Over smart then there is a condition that if the mark given by the user is greater than 100 then our program display the Message "Don't Be Smart Enter your Marks Between Limit" or else perform the Else part.

Enter the Mark:- 1000
Output:- Don't Be Smart Enter your Marks Between Limit.

Case 2:- If the user is entering the marks between the 0 to 100 and then particular grade portion will be executed and display the output in Console screen.

Enter the Mark:- 95
Output:-Your Grade Is: A or Excellent

This operation performs same for Grade B, C, D.

Case 3:- If Enter marks are not fulfilled the cases requirement than the program will perform the default case.

Enter the Mark:-25
Output:-You Grade Is: F or Fail

Also, see the program suggestion " Do Not show your Sheet to Your Parent ".

Suggestion:- C++ Program For Find A Grade Of Given Marks Using Switch Case

C Program For Find A Grade Of Given Marks Using Switch Case


int main()
/*Visit www.programmingwithbasics.com*/
   int marks;
   /*This Is a Grade Checker Program*/
   printf("\nThis Is a Grade Checker Program");
   printf("\nEnter The Marks Between 0 To 100:");
   printf("\nEnter The Mark: ");
   scanf("%d", &marks);
    /* Marks greater than 100 */
    printf("\nDon't Be Smart Enter your Marks Between Limit\n");
       case 10 :
       case 9 :
           /* Marks between 90-100 */
           printf("\nYour Grade Is: A or Excellent");
       case 8 :
       case 7 :
           /* Marks between 70-89 */
           printf("\nYour Grade Is: B or Very Good" );
       case 6 :
           /* Marks between 60-69 */
           printf("\nYour Grade Is: C or Fair" );
       case 5 :
       case 4 :
           /* Marks between 40-59 */
           printf("\nYour Grade Is: D or Pass");
       default :
           /* Marks less than 40 */
           printf("\nYou Grade Is: F or Fail\n");
           printf("\nSuggetin: Do Not show your Sheet to Your Parent");
   return 0;

Suggestion:- Java Program For Find A Grade Of Given Marks Using Switch Case


C Program For Find A Grade Of Given Marks Using Switch Case

You May Like This:-

1. Java Program To Find The Salary Of An Employee With Employee Grade

2. Java Program to Convert a person's name in Abbreviated

3. C Program For Calculator Using Switch Case

4. C++ Program For Bubble Sort

5. Java Program To Find The Gross Salary Of An Employee

6. Hacker Rank Solution For Birthday Cake Candles

7. C++ Program For Store Employee Information And Display Using Structure

8. C Program For Find A Grade Of Given Marks Using Switch Case

9. C Program For HEAP Sort In Ascending Order Also Show Complexity

10. C++ Program For Selection Sort Using Function


  1. whithout header file how can you your program work successfully

  2. Ankit Mishra3/04/2017

    Latest IDE's does not need headers
    Like codeblocks
    Che k it

  3. Replies
    1. It's Working. Thanks for Visit

  4. Instead of giving marks in input.. if I use grade in input like A and as output I want the marks limit 75-79. how can I found this type of output using codeblocks? plz help

  5. The problem said clearly using switch-case. But your solution is using if-else?

    1. Thanks for Comment This is why cause many people think they are smart, and they put marks upto 10000 and infinite. So if you Enter marks in subject is greater than 100 then the program will print a message. This is Just for Fun You Can remove and Modified.

      Keep visiting Keep sharing

  6. what is about 75 to 79 grade A- ?

    1. Hello,

      You can modify or you can add as many conditions you want. This a just an example of my College grading System so there is No grading between 75 to 79 but you can put a case for according to your Query or you can send me a Query through email so I can provide a Full solution with respect to your Query.

      Thanks For comment Keep visit keep share and Keep Healthy