The program is a simple program that calculates the total and average marks of a student based on their marks in five subjects (m1, m2, m3, m4 and m5). The program first takes input of the marks in each subject from the user. Then it calculates the total marks by adding the marks of each subject and calculates the average by dividing the total marks by 5.0. After that, the program checks if the student has passed or failed by checking if the marks in all the subjects are greater than or equal to 35. If the student has passed, then the program also calculates the grade of the student based on the average marks. The program prints the total marks, average marks,result (pass/fail) and grade of the student.
/* School Result Management 1.Five Marks input through the keyboard 2.Find total and average of the given marks. 3.Find the result whether the given marks must be >=35 4.Grade as per the following condition. 90-100 - A Grade 80-89 - B Grade 70-79 - C Grade <70 - D Grade Fail - No Grade */ #include<stdio.h> int main() { int m1,m2,m3,m4,m5,total; float avg; printf("\nEnter 5 Marks : \n"); scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5); total=m1+m2+m3+m4+m5; avg=total/5.0; printf("\nTotal : %d",total); printf("\nAverage : %f",avg); if(m1>=35&&m2>=35&&m3>=35&&m4>=35&&m5>=35) { printf("\nResult : Pass"); if(avg>=90&&avg<=100) { printf("\nGrade : A Grade"); } else if(avg>=80&&avg<=90) { printf("\nGrade : B Grade"); } else if(avg>=70&&avg<=79) { printf("\nGrade : C Grade"); } else { printf("\nGrade : D Grade"); } } else { printf("\nResult : Fail"); printf("\nGrade : No Grade"); } return 0; }To download raw file Click Here
Enter 5 Marks : 88 97 89 56 92 Total : 422 Average : 84.400002 Result : Pass Grade : B Grade
Enter 5 Marks : 34 89 78 90 78 Total : 369 Average : 73.800003 Result : Fail Grade : No Grade
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions