Hi,
I have written the following code. Which on the basis of few conditions, calculates whether the person is eligible for insurance or not.
When is execute the code, the program does'nt accept the second input and directly jumps to the third input.
Could you please suggest what is wrong witht the code.
================================================== =======
CODE:
------
Code:
#include<stdio.h>
main()
{
int age;
char gender,status;
printf("\n enter your gender m/f : ");
scanf("%c",&gender);
printf("\n enter your status a/u: ");
scanf("%c",&status);
printf("\n enter your age: ");
scanf("%d",&age);
if((status=='a')||((status=='u')&&(gender=='m')&&(age>30))||((status=='u')&&(gender=='f')&&(age>25)))
printf("you are insured");
else
printf("you are not insured");
}
================================================== ===========
OUTPUT
--------
$ ./new03.exe
enter your gender m/f : m
enter your status a/u: <does'nt wait for the user to enter the value>
enter your age: 23
you are not insured
================================================== ===========