Today we run C programming to find out the grade of a student when the marks of 6 subjects are given.
The method of assigning grade is –
percentage>=85 grade=A
percentage<85 and percentage>=70 grade=B
percentage<70 and percentage>=55 grade=C
percentage<55 and percentage>=40 grade=D
percentage<40 grade=E
This c language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.
Find grade of a student according to their percentage in c programming
#include
void main()
{
float m1,m2,m3,m4,m5,m6,total,per;
char grade, name;
printf(“Please Enter the Student Name:”);
scanf(“%c”,&name);
printf(“Enter all subjects marks of %c: “,name);
scanf(“t%ft%ft%ft%ft%ft%f”,&m1,&m2,&m3,&m4,&m5,&m6);
printf(“n”);
//Calculate the percentage of all Marks
total=m1+m2+m3+m4+m5+m6;
per=total/6;
//Condtion Check for to find the grade of
if(per>33){
if(per>=85){
grade=’A’;
}
else if(per>=70){
grade=’B’;
}
else if(per>=55){
grade=’C’;
}
else if(per>=40){
grade=’D’;
}
else {
grade=’E’;
}
printf(“%c passed with %c Grade and %fn”,name,per,grade);
}
else{
printf(“%c is Fail in the Examnation ” name);
}
getch();
}
Please Enter the Student Name: Abcd
Enter all subjects marks of Abcd: 75
74
45
89
100
99
Abcd passed with B Grade and 80.33333333333333%
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
Please share your experience about this post,
Thank You!