Answer to Question #99421 in C++ for Caleb

Question #99421
Write an expression that prints "Eligible" if userAge is between 18 and 25 inclusive.
Ex: 17 prints "Ineligible", 18 prints "Eligible".
#include <iostream>
using namespace std;

int main() {
int userAge;

cin >> userAge;

if (/* Your solution goes here */) {
cout << "Eligible" << endl;
}
else {
cout << "Ineligible" << endl;
}

return 0;
}
1
Expert's answer
2019-12-09T14:03:33-0500

#include <iostream>


using namespace std;


int main() {

    int userAge;

    cin >> userAge;

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

        cout << "Eligible" << endl;

    }

    else {

        cout << "Ineligible" << endl;

    }

    return 0;

}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS