- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
In the program below, we've asked the user to enter the marks obtained in 5 subjects to calculate and display the average and percentage marks
Source Code: Calculate Average and Percentage of Marks
/* C++ Program - Calculate Average and Percentage of Marks using Array */ #include<iostream.h> #include<conio.h> void main() { clrscr(); int mark[5], i; float sum=0; cout<<"Enter marks obtained in Science, Hindi, Maths, Computers, English :"; for(i=0; i<5; i++) { cin>>mark[i]; sum=sum+mark[i]; } float avg=sum/5; float perc; perc=(sum/500)*100; cout<<"Average Marks = "<<avg; cout<<"\nPercentage = "<<perc<<"%"; getch(); }Output
Enter marks obtained in Science, Hindi, Maths, Computers, English : 90 90 90 90 90 Average Marks= 90 Percentage = 90 %