Program to check the person is child, teenager or an adult
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int age; //to store age
cin>>age; //reads age
if(age<13){ //if age is less than 13 the person is a child
cout<<"Child"<<endl;
}
else if(age>=13 && age<=19){ //if age is between 13 to 19 the person is a teenager
cout<<"Teenager"<<endl;
}
else{ //if age greater than 19 person is an adult
cout<<"Adult"<<endl;
}
return 0;
}
Input
17
Output
Teenager
0 Comments