Answer to Question #262667 in C++ for Rille

Question #262667

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.

1
Expert's answer
2021-11-08T07:37:55-0500
#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:


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
APPROVED BY CLIENTS