How to calculate percentage of 5 subjects in C++ Programming ?
C++ Program to Calculate Percentage of 5 Subjects |
//Program to calculate percentage of 5 subjects.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d,e;
cout<<"Enter marks of 1st subject: ";
cin>>a;
cout<<"Enter marks of 2nd subject: ";
cin>>b;
cout<<"Enter marks of 3rd subject: ";
cin>>c;
cout<<"Enter marks of 4th subject: ";
cin>>d;
cout<<"Enter marks of 5th subject: ";
cin>>e;
a=(a+b+c+d+e)/5;
cout<<"The percentage is: "<<b<<"%";
getch();
}
This C++ Program to calculate percentage of 5 subjects.