0% found this document useful (0 votes)
7 views2 pages

Student Grade Calculation in C

The document contains a C programming example that grades a student's mark based on predefined ranges. It prompts the user to enter a mark and assigns a grade from A to F based on the input. If the mark is invalid, it requests the user to try again.

Uploaded by

lithubco
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Student Grade Calculation in C

The document contains a C programming example that grades a student's mark based on predefined ranges. It prompts the user to enter a mark and assigns a grade from A to F based on the input. If the mark is invalid, it requests the user to try again.

Uploaded by

lithubco
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2/18/2014

1
2/18/2014

Grading example
• #include<stdio.h>
• void main()
• {
• float mark;
• char grade;
• printf("Enter the mark attained by the student ");
• scanf("%f", &mark);
• if((mark>=70) && (mark<=100))
• grade = 'A';
• else if(mark>=60)
• grade = 'B';
• else if(mark>=50)
• grade = 'C';
• else if(mark>=40)
• grade = 'D';
• else if((mark>=0) && (mark<40))
• grade = 'F';
• else
• printf("Invalid mark..try again");
• printf("The student scored %f which is grade %c ",mark, grade);
• }

You might also like