- Get link
- Other Apps
Calculating adult age in c languages Here we writing code of c language // How to Know that the person is adult and child in c language ? 1. #include <stdio.h> #include <conio.h> int main () { // Here we declared the variable int age ; printf ( "Enter age of the person :" ); scanf ( " %d " , & age ); //Here we entered the age // We use if else statement for check that entered age person was child or adult if ( age > 18 ) { printf ( "This age person is Adult" ); } else { printf ( "This age person is Child" ); } return 0 ; } Output - Enter the age of the person :12 This age person is Child 2. using switch statement // making age checker through switch statement #include <stdio.h> int main () { int option ; printf ( "Enter the option in the following : \n " ); printf ( "1.Age is greater then 18