C Program to Enter Marks of Five Subjects and calculate Total, Average and Percentage ?
Q:- Write a C Program to Enter Marks of Five Subjects and Calculate Total, Average and
Percentage ?
Percentage ?
Input
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float eng,phy,che,math,comp;
float total,average,percentage;
float total,average,percentage;
clrscr();
printf("Enter Marks of Five Subjects=");
scanf("%f%f%f%f%f",&eng,&phy,&che,&math,&comp);
scanf("%f%f%f%f%f",&eng,&phy,&che,&math,&comp);
total = eng+phy+che+math+comp;
average = total/5.0;
percentage = (total/500.0)*100;
average = total/5.0;
percentage = (total/500.0)*100;
printf("Total Marks =%.2f",total);
printf("Average Marks =%.2f",average);
printf("Percentage =%.2f",percentage);
printf("Average Marks =%.2f",average);
printf("Percentage =%.2f",percentage);
getch();
}
Output
Enter Marks of Five Subjects =
95
76
85
90
89
Total Marks = 435.00
Average Marks = 87.00
Percentage = 87.00%
95
76
85
90
89
Total Marks = 435.00
Average Marks = 87.00
Percentage = 87.00%
Comments
Post a Comment