12. Write a program to read marks from keyboard and your program should
display equivalent grade according to following table(if else ladder)
Marks
Grade
100 - 80 Distinction
79 - 60 First Class
59 - 40 Second
Class
< 40 Fail.
#include<stdio.h>
#include<conio.h>
int main()
{
int m;
printf("\nEnter your marks : ");
scanf("%d",&m);
if(m>=80&& m<=100)
printf("\nDistinction");
else if(m<=79 && m>=60)
printf("\nFirst Class");
else if(m<=59 && m>=40)
printf("\nSecond class");
else if(m<40)
printf("\nFail");
else
printf("\nEnter correct marks");
getch();
return 0;
}
Sample output
Comments