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.

Expert's answer

#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!

LATEST TUTORIALS
APPROVED BY CLIENTS