Get Marks according to Grade: C Program

0
58

Here is a code that accepts marks of students and display the grade according to student’s marks.
Normaly each university has its own grade system,below we take one example of marks distributed according to garade.Here this Program using if-else if ladder statement.

Marks         Grade

100-80        Distinction
60-79          First Class
35-59          Second Class
0-34            Fail
[message_box title=”Program ” color=”red”]

/* Write a program to read marks from keybord and your program should display equivalent grade according to table */

/* Written by Utpal Chaudhary */

/*Student of L.D COLLEGE OF ENGINEERING,Ahmedabad-15,Gujarat */

#include <stdio.h>
#include <conio.h>

void main()
{
int m;
clrscr();

printf (“Enter marks:”);

scanf(“%d”,&m);

if(m>=80 && m<=100)
{
printf (“Distinction”);

}
else if(m>=60 && m<80)
{
printf(“First Class”);

}
else if(m>=35 && m<60)
{
printf(“Second Class”);
}

else if(m>=0 && m<35)
{
printf(“Fail”);
}

else
{
printf(“Fail”);
}
getch();

}
[/message_box]

[message_box title=”Output 1″ color=”red”]

Enter marks:85
Distinction

[/message_box]

[message_box title=”Output 2″ color=”red”]

Enter marks:40
Second Class

[/message_box]

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz