Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

nested if example in c

#include <stdio.h>

int main()
{
 int age;

 printf("Please Enter Your Age Here:
");
 scanf("%d",&age);

 if ( age < 18 )
 {
  printf("You are Minor.
");
  printf("Not Eligible to Work");
 }
 else
 {

  if (age >= 18 && age <= 60 ) 
   { 
    printf("You are Eligible to Work 
"); 
    printf("Please fill in your details and apply
"); 
   } 
  else 
   { 
    printf("You are too old to work as per the Government rules
");
    printf("Please Collect your pension! 
");
   }
 }

 return 0;
}
Source by www.tutorialgateway.org #
 
PREVIOUS NEXT
Tagged: #nested
ADD COMMENT
Topic
Name
4+8 =