HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C Program to Input Marks of Five Subjects and Find Percentage and Grade Using If Else ?


Q:- Write a C Program to Input Marks of Five Subjects and Find Percentage and
       Grade Using If Else ?
Percentage >=90% : Grade A
Percentage >=80% : Grade B
Percentage >=70% : Grade C
Percentage >=60% : Grade D
Percentage >=40% : Grade E
Percentage <40%  : Grade F
       Input
         #include<stdio.h>
         #include<conio.h>
         int main()
   {
int phy,che,math,eng,comp;
float per;
printf(“Enter Five Subjects Marks =”);
scanf(“%d%d%d%d%d”,&phy,&che,&math,&eng,&comp);
per = (phy+che+math+eng+comp)/5.0;
printf(“Percentage = %.2f\n”,per);
if(per >= 90)
{
printf(“Grade A.”);
}
else if(per >= 80)
{
printf(“Grade B.”);
}
else if(per >= 70)
{
printf(“Grade C.”);
}
else if(per >= 60)
{
printf(“Grade D.”);
}
else if(per >= 40)
{
printf(“Grade E.”);
}
else if(per < 40)
{
printf(“Grade F.”);
}
else
{
printf(“Invalid Input!!!!!!!!!!”);
}
getch();
   }


Output

Enter Five Subjects Marks =
95
95
97
98
90
Percentage = 95.00
Grade A.

Comments