PROGRAM CALCULATE SUM OF FIVE SUBJECTS AND FIND PRECENTAGE

/*PROGRAM TO CALCULATE SUM OF FIVE SUBJECTS AND FIND PRECENTAGE*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,m,sum=0;
float per=0,t;
clrscr();
printf(“Enter the maximum marks for each subject: “);
scanf(“%d”,&m);
printf(“Enter the marks obtained by the student in each subject: “);
scanf(“%d%d%d%d%d”,&a,&b,&c,&d,&e);
if((m<a)||(m<b)||(m<c)||(m<d)||(m<e))
printf(“Obtained marks should not exceed %d marks. So enter valid marks only.”,m);
else
{
t=m*5;
sum=a+b+c+d+e;
per=(sum/t)*100;
printf(“\tTotal marks are: %.2f\n”,t);
printf(“\tTotal marks obtained by the student are: %d\n”,sum);
printf(“\tTotal percentage:%.2f\n”,per);
}
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *