C Program to display child and adult based on age
Accept an integer n as input
For 0<=n && n<12
For 12<=n && n<24
For all other numbers, display "INVALID INPUT".
For example:
Input | Result |
---|---|
0 | CHILD |
19 | ADULT |
144 | INVALID INPUT |
Code
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
if(0<=n && n<18){
printf("CHILD");
}
else if(18<=n && n<144){
printf("ADULT");
}
else{
printf("INVALID INPUT");
}
}
Other Programs