C Program to display child and adult based on age

C Program to display child and adult based on age

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:


InputResult
0CHILD
19ADULT
144INVALID 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

Load comments