Write a Program to determine eligibility of an applicant for teacher interview using the criteria shown in table below. The program should ask the name and gender of the applicant and display the results as “Congratulation Mr. or Ms. XXX, you are eligible for the interview” or “Sorry Mr. or Ms. XXX, you are not eligible for the interview”. Mr. or Ms. is displayed according to the gender provided by the user and XXX is the name entered from user keyboard

 


Criteria Value
age more than 18
height more than 1.5 meters
experience more than 3 years
C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
  char name[10];
  int gender,age,Exp;
  float height;
  printf("Enter your name:");
  scanf("%s",&name);
  printf("Please select 1.for male and 2.for female\n");
  scanf("%d",&gender);
   printf("Enter your age:");
  scanf("%d",&age);
  printf("Enter your height in meters:");
  scanf("%f",&height);
  printf("Enter your Years of Experience");
  scanf("%d",&Exp);
  switch(gender)
  {
  case 1:
           if(age>=18 && height>=1.5 && Exp>=3)
               printf("Congratulation Mr %s you are eligible for the interview",name);
           else
                printf("Sorry Mr %s you are not eligible for the interview",name);
           break;

   case 2:
         if(age>18 && height>1.5 && Exp>3)
               printf("Congratulation Mrs %s you are eligible for the interview",name);
           else
                printf("Sorry Mrs %s you are not eligible for the interview",name);
           break;
  default: printf("please enter gender correctly");

  }
}

0 Comments:

Post a Comment