c programming for Generate mark sheet of students and class
In this post we will show you how to generate mark-sheet of students and class in c programming. flowing code will help you to perform program.
hear we calculate result result using 5 subject and calculate percentage of students and assign class to student.
// include header file
# include <stdio.h>
# include <conio.h>
// main function
void main()
{
int m1,m2,m3,m4,m5;
int total;
float per;
clrscr();
// enter data of result
printf("Enter m1: ");
scanf("%d",&m1);
printf("Enter m2: ");
scanf("%d",&m2);
printf("Enter m3: ");
scanf("%d",&m3);
printf("Enter m4: ");
scanf("%d",&m4);
printf("Enter m5: ");
scanf("%d",&m5);
// calculate result of student
total=m1+m2+m3+m4+m5;
// calculate percentage
per=total/5.0;
// calculate class of student
if(per>=70)
printf("\nDistinction");
else if(per>=60)
printf("\nFirst Class");
else if(per>=50)
printf("\nSecond Class");
else if(per>=40)
printf("\nPass Class");
else
printf("\nFAIL");
getch();
}