. 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.
#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;
}
Comments
Leave a comment