Write a C Program to Calculate Total Marks, Average Marks and Percentage of Seven Subjects

July 10, 2022 0 Comments

In this tutorial learn how you can calculate total marks obtained, average marks and percentage of seven subjects. Here are the conversion formulas of total marks, average marks, and percentage.

Total Marks= Sum of 7 Subjects

Average Marks = Total Marks/ No of Subjects

Percentage = (Total Marks*100)/Total Full Marks of all Subjects

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.


write c program to calculate total marks average marks and percentage of seven subjects



Write a Program to Calculate Total Marks Obtained, Average Marks and Percentage of Seven Subjects

Here is the code that ask for name of student and marks for seven subjects then calculate and display total marks obtained, average marks and overall percentage obtained in C programming.

#include <stdio.h> //WAP that ask for Name of student and marks for seven subjects. Calculate and display total marks obtained, average marks and overall percentage obtained.
int main(){
char name[100];
printf("Enter your name:");
scanf("%s",&name);
float sub1,sub2,sub3,sub4,sub5,sub6,sub7,total,average,percentage;
printf("Enter marks of seven subjects:n");
scanf("%f%f%f%f%f%f%f",&sub1,&sub2,&sub3,&sub4,&sub5,&sub6,&sub7);
total=sub1+sub2+sub3+sub4+sub5+sub6+sub7;
average=total/7;
percentage=(total*100)/700;
printf("Student Name:%sn",name);
printf("Total Marks:%fnAverage Marks:%fnPercentage:%f",total,average,percentage);
return 0;

}

Test Live At Jdoodle



Conclusion

This is how you can calculate total marks obtained, average marks and percentage of seven subjects. Comment below if you like our tutorial.

Leave a comment

Gallery