QAProgramming › Write an expression that prints “Eligible” if userAge is between 18 and 25 inclusive.
Q

Write an expression that prints “Eligible” if userAge is between 18 and 25 inclusive.

Ex: 17 prints "Ineligible", 18 prints "Eligible".

#include

using namespace std;

int main() {

int userAge;

cin >> userAge;

if (/* Your solution goes here */) {

cout << "Eligible" << endl;

}

else {

cout << "Ineligible" << endl;

}

return 0;

}

A

Simply insert this condition:

if (userAge >= 18 && userAge <= 25) {

3 years ago
353 Views