Solved Question for If-Else-If Statement

Consider the example of identifying the status of an individual, based on the person’s age. The tasks include

• Reading the age

• If the individual is aged between 1 and 18 years. It should be decided that he is a minor.

• If the age is below 40 years , the person is a major

• If the age exceeds 40 years, the person is an adult.

• Adjudging the status of the individual after the decision and finally,

• Printing the status of the individual.

main ( )

{

int age ;

printf (“Enter the age value\ n” ) ;

scanf (“%d” , &age );

if (age >= 1 && age < =18 )

printf (“The individual is a minor’ ) ;

else if (age >= 19 && age < = 40 )

printf (“The individual is a major' ) ;

else if (age >=41 && age< = 120 )

printf ("The individual is an adult) ;

else

printf (' Invalid age value is entered' ) ;

}

Live Email Based Online Homework Assignment Help InQuestion For If-Else-If Statement

Transtutors has a team of highly skilled and certified tutors of C language who can clear your doubt regarding questions of if-else-if statement. You can submit your school, college or university level computer science homework or assignment to us and we will make sure that you get the answers you need which are timely and also cost effective Also you can directly interact with our C languagetutors for a one to one session and get answers to all your questions of if-else-if statement.