C Program to Enter Marks of Five Subjects and Calculate Total, Percentage, Result, and Grade
Introduction:
In this article, we'll talk about a C program that lets users submit their scores for five different topics and then uses those scores to compute the grade, outcome, and %. Teachers, students, and anybody else who wants to assess academic achievement can all benefit from using this tool.
Understanding the Problem
In educational institutions, figuring out the total, percentage, outcome, and grade based on the marks attained in five topics is a typical assignment. The computation procedure is automated by this application, which reduces potential mistakes and saves time.
Coding:
#include<stdio.h>
#include<conio.h>
main()
{
char name[30];
int cl,a,b,c,d,e,t;
float p;
printf("enter name\n");
scanf("%s",name);
printf("enter class\n");
scanf("%d",&cl);
printf("enter five sub marks\n");
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
t=a+b+c+d+e;
p=t/5;
printf("total=%d\n",t);
printf("percentage=%f\n",p);
if(a>=35&&b>=35&&c>=35&&d>=35&&e>=35)
printf("\n Result=Pass");
else
printf("\n Result=fail");
if(p>=90)
printf("\n Grade: A+");
else if(p>=80)
printf("\n Grade:A");
else if(p>=70)
printf("\n Grade:B+");
else if(p>=60)
printf("\n Grade:B");
else if(p>=50)
printf("\n Grade:C+");
else if(p>=40)
printf("\n Grade:C");
else if(p>=35)
printf("\n Grade:D");
else
printf("\n Grade:Not Grade");
}
Output:
Conclusion:
In this article, we've spoken about a C program that lets users submit their grades for five different topics and then uses those marks to compute the grade, outcome, and percentage. For automating calculations and assessing academic success, this application may be helpful. You may quickly determine the necessary values for any given collection of marks by using the provided algorithm and C code.
No comments:
Post a Comment