C++ : read age of a person and display remarks


#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int age;
do{
cout<<"Enter your age : ";
cin>>age;
if(age<0 || age>100)
   cout<<"Invalid age entry ! ";

}while(age<0 || age>100);

if(age<12)
cout<<"You are child.";

else if(age>=12 && age<20)
   cout<<"You are Teenager.";
   
else if(age>=20 && age<30)
   cout<<"you are Adult.";
   
else if(age>=30 && age<55)
   cout<<"You are Young.";
   
else
   cout<<"You are Old.";
   
getch();
return(0);

}

No comments:

Post a Comment