Program for aggregate marks and percentage calculation
(Ref: Let us c-chapter1)
This program calculates the total and percentage marks.
If the marks obtained by a student in five different subjects are input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.
#include<stdio.h>
void main()
{
int m1,m2,m3,m4,m5,total;
float prcnt;
clrscr();
printf("Enter marks for first subject:");
scanf("%d",&m1);
printf("Enter marks for second subject:");
scanf("%d",&m2);
printf("Enter marks for third subject:");
scanf("%d",&m3);
printf("Enter marks for fourth subject:");
scanf("%d",&m4);
printf("Enter marks for fifth subject:");
scanf("%d",&m5);
total=m1+m2+m3+m4+m5;
prcnt=total/5;
printf("Total marks obtained by the student is :%d",total);
printf("\nPercentage is:%f ",prcnt);
getch();
}
(Ref: Let us c-chapter1)
This program calculates the total and percentage marks.
If the marks obtained by a student in five different subjects are input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.
#include<stdio.h>
void main()
{
int m1,m2,m3,m4,m5,total;
float prcnt;
clrscr();
printf("Enter marks for first subject:");
scanf("%d",&m1);
printf("Enter marks for second subject:");
scanf("%d",&m2);
printf("Enter marks for third subject:");
scanf("%d",&m3);
printf("Enter marks for fourth subject:");
scanf("%d",&m4);
printf("Enter marks for fifth subject:");
scanf("%d",&m5);
total=m1+m2+m3+m4+m5;
prcnt=total/5;
printf("Total marks obtained by the student is :%d",total);
printf("\nPercentage is:%f ",prcnt);
getch();
}
No comments:
Post a Comment