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>
void main()
{
int a;
printf("Enter the marks= ");
scanf("%d",&a);
if(a<=100 && a>=80)
printf("Pass with Distinction",a);
else if(a<=79 && a>=60)
printf("Pass with First class",a);
else if(a<=59 && a>=40)
printf("Pass with Second class",a);
else
printf("Student is fail",a);
getch();
}
#include<conio.h>
void main()
{
int a;
printf("Enter the marks= ");
scanf("%d",&a);
if(a<=100 && a>=80)
printf("Pass with Distinction",a);
else if(a<=79 && a>=60)
printf("Pass with First class",a);
else if(a<=59 && a>=40)
printf("Pass with Second class",a);
else
printf("Student is fail",a);
getch();
}
#OUTPUT:
Comments
Post a Comment