The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules: Percentage above or equal to 60 - First division Percentage between 50 and 59 - Second division Percentage between 40 and 49 - Third division Percentage less than 40 - Fail C Program to calculate the division obtained by the student.

/*The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:
Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
C Program to calculate the division obtained by the student.*/
#include<stdio.h>
int main()
{
	float m1, m2, m3, m4, m5, avg, per;
	printf("\nEnter 5 subject marks: ");
	scanf("%f %f %f %f %f", &m1, &m2, &m3, &m4, &m5);
	per = (m1 + m2 + m3 + m4 + m5) * 100 / 500;
	printf("Student get %0.2f percentage. \n", per);
	if (per >= 60)
		printf("1st Division");
	else if (per >= 50 && per <= 59)
		printf("2nd Division");
	else if (per >= 40 && per <= 49)
		printf("3rd Division");
	else if (per<40)
		printf("Fail");
	return 0;
}

Output :
Enter 5 subject marks: 50
40
60
70
90
Student get 62.00 percentage.
1st Division



Leave a comment


Other Language Programs