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 <iostream>
inline bool Admissible(int math, int physics, int chemistry) {
return {
math >= 60
&& physics >= 50
&& chemistry >= 40
&& (
(math + physics + chemistry) >= 200
|| (math + physics) >= 150
)
};
}
int main() {
int math, physics, chemistry;
std::cin >> math >> physics >> chemistry;
if (Admissible(math, physics, chemistry)) {
std::cout << "Welcome!\n";
}
else {
std::cout << "You shall not pass!\n";
}
return 0;
}
Comments
Leave a comment