The Admission to a professional course is done using the following conditions.
a) Marks in Maths> =60
b) Marks in Physics >=50
c) Marks in chemistry >=40
d) Total in all the three subjects >=200 (or) Total in Maths and Physics >=150
Given the marks of three subjects, write a C++ program to process the applications to list the eligible candidates. [Note: Use call by value]
#include<bits/stdc++.h>
using namespace std;
int IsApplicable(float Maths,float Physics,float chemistry)
{
float total,t_phy_math;
total=Maths+Physics+chemistry;
t_phy_math=Maths+Physics;
if(Maths>=60 && Physics >=50 && chemistry >=40)
{
if(total>=200 || t_phy_math>=150)
{
return 1;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
int main()
{
float Maths,Physics,chemistry;
cout<<"Enter marks in Maths ";
cin>>Maths;
cout<<"\nEnter marks in Physics ";
cin>>Physics;
cout<<"\nEnter marks in Chemistry ";
cin>>chemistry;
if(IsApplicable(Maths,Physics,chemistry))
{
cout<<"\nThe applicant is eligible for admission";
}
else
{
cout<<"\nThe applicant is not eligible for admission";
}
}
Comments
Leave a comment