/*6.Write a C Program to read percentage of marks and to display appropriate grade (using switch case) */
#include<stdio.h>
void main()
{
int percent;
clrscr();
printf("Enter Marks in Percentage:");
scanf("%d",&percent);
switch(percent/10)
{
case 10:
case 9:
case 8:
case 7:printf("Distinction!\n");
break;
case 6:
printf("First Class!\n");
break;
case 5: printf("Second Class!\n");
break;
case 4: printf("Pass!\n");
break;
default:printf("Fail!\n"); break; } getch(); }
No comments :
Post a Comment