C Program to Calculate Percentage of Marks of Student

Advertisements

Prev Tutorial Next Tutorial

C Program to Calculate Percentage of Marks of Student

Write a C Program to Calculate Percentage of Marks of Student, To calculate average and percentage marks of a student in C programming, you have to ask to the user to enter marks obtained in some number of subjects (5 subjects here, i.e., Physics, Chemistry, Maths, CS, and English).

Percentage can be calculated as the sum of marks obtained divided by the total marks and whole multiplied to 100.
Percent means per cent (hundreds), i.e., a ratio of the parts out of 100. The symbol of percent is %. We generally count percentage of marks obtained, return on investment etc. Percentage can go beyond 100% also.

Algorithm to calculate Average and Percentage

  • First Received marks of each subject.
  • Calculate sum of all subjects marks.
  • Divide total marks by number of subject (percentage=total marks / number of subject).
  • Finally print percentage on screen.

C Program to Calculate Percentage of Marks of Student

#include<stdio.h>
#include<conio.h>

void main()
{
	void main()
{
	int mark[5], i;
	float sum=0, perc, avg;
    clrscr();	
    printf("Enter marks obtained in Physics, Chemistry, Maths, CS, English :");
	for(i=0; i<5; i++)
	{
	 scanf("%d",&mark[i]);
	 sum=sum+mark[i];
	}
	avg=sum/5;
	perc=(sum/500)*100;
	printf("Average Marks: %f",avg);
	printf("\nPercentage: %f%",perc);
	getch();
}

Output

Enter Marks Obtained in Physics, Chemistry, Maths, CS, English:
90
50
70
60
80
Average Marks: 70
Percentage: 70
C Program to Calculate Percentage of Marks of Student
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements