Write a program that accepts marks in five subjects and calculates the total percentage marks.
program find out the percentage of a student.
In this program we have take marks of student out off 100 where marks in real form then be use float type variable declare 5 variable m1,m2,m3,m4,m5 float type.
Now we find out the percentage of a student in five subjects. take a variable store the value of %age as float type.
firstly, find sum of marks gain by the student, then after % = (sum/500)*100 we can also write sum/5;
#include<stdio.h>
int main()
{
float m1,m2,m3,m4,m5,per,sum;
printf("Marks in English:");
scanf("%f",&m1);
printf("Marks in Hindi:");
scanf("%f",&m2);
printf("Marks in Physics:");
scanf("%f",&m3);
printf("Marks in Maths:");
scanf("%f",&m4);
printf("Marks in Chemistry:");
scanf("%f",&m5);
sum=m1+m2+m3+m4+m5;
per=sum/5;
printf("Total percentage marks:%.2f %%",per);
return 0;
}
Output:
Marks in English:68
Marks in Hindi:95
Marks in Physics:98
Marks in Maths:68
Marks in Chemistry:55
Total percentage marks:76.80 %
๐๐ Thank you (●'◡'●)
Comments
Post a Comment