C++ Program to Calculate Percentage of Marks

Advertisements

Prev Tutorial Next Tutorial

Calculate Percentage of Student Marks Program in C++

Welcome once again on sitesbay, today we discuss about how to write code for calculate percentage of marks program in C++. For calculate percentage of marks obtained by student, divide total marks by number of subject ( percentage=total marks / number of subject ).

Algorithm to Calculate Percentage of Students Marks

  • First Receive Student 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 Student Marks

#include<iostream.h>
#include<conio.h>

void main()
{
int no, i;
float marks[10], per=0, total=0;
clrscr();
cout<<"Enter number of subject: ";
cin>>no;
cout<<"Enter marks of "<<no<<" subjects";
for(i=0; i<no; i++)
{
cin>>marks[i];
}
for(i=0; i<no; i++)
{
total=total+marks[i];
}
per=total/no;
cout<<"Percentage: "<<per;
getch();
}

Output 1

Enter number of subject: 4
Enter marks of 4 subject: 
80
93
87
95
Percentage: 88.75 %

Output 2

Enter number of subject: 5
Enter marks of 5 subject: 
83
86
94
73
92
Percentage: 85.6 %

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