Answer to Question #148639 in C++ for Gerald

Question #148639
Make a program that will input age,
Check… age<=20 Display “Young”
Age>=21 Display “Adult”
Your program will be terminated if you input zero in age.
1
Expert's answer
2020-12-04T07:54:44-0500
#include <iostream>

using namespace std;

int main() {
    int age;
  
    while (true) {
        cin >> age;
        
        if (age == 0)
            break;
        else if (age <= 20)
            cout << "Young";
        else if (age >= 21)
            cout << "Adult";
    }
}

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