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.
#include<iostream>
using namespace std;
int main(){
int age;
cout<<"Enter your age:"<<endl;
cin>>age;
cout<<"Entered age is:"<<age<<endl;
if(20>=age & age!=0){
cout<<"Young"<<endl;
}else{
if(age>=21){
cout<<"Adult"<<endl;
}
}
return 0;
}
Output:
Comments
Leave a comment