0% found this document useful (0 votes)
64 views3 pages

(Marks : Include Int Int

This C program uses a switch case statement to take a student's marks as input between 0-100, divides it by 10, and uses the result to print the student's grade. It prints grades of A, B, C, D, E, E--, or F depending on whether the marks are between 90-100, 80-89, 70-79, 60-69, 50-59, 40-49, or less than 40 respectively. If the marks entered are greater than 100, it prints a message saying the marks are outside the valid limit.

Uploaded by

MURALI DG
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)
64 views3 pages

(Marks : Include Int Int

This C program uses a switch case statement to take a student's marks as input between 0-100, divides it by 10, and uses the result to print the student's grade. It prints grades of A, B, C, D, E, E--, or F depending on whether the marks are between 90-100, 80-89, 70-79, 60-69, 50-59, 40-49, or less than 40 respectively. If the marks entered are greater than 100, it prints a message saying the marks are outside the valid limit.

Uploaded by

MURALI DG
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/ 3

include<stdio.

h>

int main()
{
int marks;
/*C Program to Find Grade of a Student Using Switch Case*/

printf("\n-----------------------------------");
printf("\nEnter The Marks Between 0 To 100:");

printf("\nEnter The Mark: ");


scanf("%d", &marks);

if(marks>100)
{
/* Marks greater than 100 */
printf("\nDon't Be Smart Enter your Marks Between Limit\n");
}
else
{
switch(marks/10)
{
case 10 :
case 9 :
/* Marks between 90-100 */
printf("\n Your Grade is: A");
break;
case 8 :
/* Marks between 80-89 */
printf("\n Your Grade is: B" );
break;
case 7 :
/* Marks between 70-79 */
printf("\n Your Grade is: C" );
break;
case 6 :
/* Marks between 60-69 */
printf("\n Your Grade is: D" );
break;
case 5 :
/* Marks between 50-59 */
printf("\n Your Grade is: E" );
break;
case 4 :
/* Marks between 40-59 */
printf("\n Your Grade is: E--");
break;
default :
/* Marks less than 40 */
printf("\n You Grade is: F
printf("\n You Grade is: F or Fail\n");
}
}
getch();
return 0;
}
#include<stdio.h>
int main()
{
int score;

printf("Enter score( 0-100 ): ");


scanf("%d", &score);

switch( score / 10 )
{

case 10:
case 9:
printf("Grade: A");
break;

case 8:
printf("Grade: B");
break;

case 7:
printf("Grade: C");
break;

case 6:
printf("Grade: D");
break;

case 5:
printf("Grade: E");
break;

default:
printf("Grade: F");
break;

return 0;
}

You might also like