Header Ads

C++ Program that Accepts Marks in 5 Subjects and Outputs Average Marks. Calculate Total Marks and Calculate Average Marks

Write a program that input marks of Five subjects of a student. Find the total marks and average marks. If average marks are more than 60 it displays  "Your marks are more than 60 You Pass".  using simple "if " statement using c++. 

1. Declare 5 Subjects Variables in Integer Types. 

2. User Input 5 Subjects Marks using Prompt

3. Calculate Total Marks 

4. Calculate Averages Marks

5. Print Message if Averages Marks are Greater Than 60%

Program Source Code


#include<iostream>

 using namespace std;

 main(){

  int eng,phy,chem,math,comp,sum;

  float avg;

  cout<<"-----Enter Your Five Subject Marks----"<<endl;

  cout<<"Plz Enter English Marks :";

  cin>>eng;

  cout<<"Plz Enter Physics Marks :";

  cin>>phy;

  cout<<"Plz Enter Chemistry Marks :";

  cin>>chem;

  cout<<"Plz Enter Mathematics Marks :";

  cin>>math;

  cout<<"Plz Enter Computer Marks :";

  cin>>comp;

  sum= eng+phy+chem+math+comp;

  avg = sum/5.0;

  cout<<"\n---------Student Result------------"<<endl;

  cout<<"Your Total Marks are :"<<sum<<endl;

  cout<<"Your Average Marks are :"<<avg<<endl;

  if(avg>= 60){

  cout<<"Average Marks are more than 60% You Pass"<<endl;

}

 }


Output Program 



Related Program

Calculate Area of Different Shapes using C++ | Area of Circle Rectangle Triangle and Square using C++


No comments

Powered by Blogger.