Program: 5
Write a C program to find the sum and percentage of marks.
#include
#include
void main()
{
int ma, en, ph, ch, cs;
float sum, per;
printf("Enter the marks of Maths= ");
scanf("%d", &ma);
printf("Enter the marks of English= ");
scanf("%d", &en);
printf("Enter the marks of Physics= ");
scanf("%d", &ph);
printf("Enter the marks of Chemistry= ");
scanf("%d", &ch);
printf("Enter the marks of Computer_Science= ");
scanf("%d", &cs);
sum = ma+en+ph+ch+cs;
per=(sum)/5;
printf("The Percentage marks obtained= %f", per);
getch();
}
|
Output |
Enter the marks of Maths= 67 Enter the marks of English= 80 Enter the marks of Physics= 95 Enter the marks of Chemistry= 45 Enter the marks of Computer_Science= 87 The Percentage marks obtained= 74.800003 |
Leave a Comment