[go: up one dir, main page]

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

2D Grade Determination: Sprno:9223

The document contains a C program that determines a student's grade based on their marks inputted between 0 and 100. It uses a switch statement to categorize the marks into grades A through F. An example output shows that entering 85 results in a grade of B.

Uploaded by

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

2D Grade Determination: Sprno:9223

The document contains a C program that determines a student's grade based on their marks inputted between 0 and 100. It uses a switch statement to categorize the marks into grades A through F. An example output shows that entering 85 results in a grade of B.

Uploaded by

jayaprakash9223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sprno:9223

2D GRADE DETERMINATION

PROGRAM:
#include <stdio.h>
int main()
{
int marks;
printf("Enter your marks (0 - 100): ");
scanf("%d", &marks);

if (marks < 0 || marks > 100)


{
printf("Invalid marks entered.\n");
}
else
{
switch (marks / 10)
{
case 10:
case 9:
printf("Grade: A\n");
break;
case 8:
printf("Grade: B\n");
break;
case 7:
printf("Grade: C\n");
break;
case 6:
printf("Grade: D\n");
break;
case 5:
Sprno:9223

printf("Grade: E\n");
break;
default:
printf("Grade: F (Fail)\n");
}
}
return 0;
}

OUTPUT:
Enter your marks (0 - 100): 85
Grade: B

You might also like