Answer to Question #289978 in C++ for ali

Question #289978

. Write a program that reads the user’s age and then prints “You are a child” if the age < 18, “You are an Adult” if 18<= age <=65, and “You are a senior citizen” if age >65. 


1
Expert's answer
2022-01-24T15:29:15-0500
#include <iostream>
using namespace std;


int main() {
    int age;


    cout << "Please enter your age: ";
    cin >> age;


    if (age < 18) {
        cout << "You are a child";
    }
    else if (age <= 65) {
        cout << "You are an Adult";
    }
    else {
        cout << "You are a senior citizen";
    }


    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