Check out this code.
#include <stdio.h>
int main(void) {
int age;
char sex, mar;
/* input age */
printf("Enter age\n");
scanf("%d", &age);
/* input sex */
printf("Enter sex : M or F\n");
scanf(" %c", &sex);
/* input marital status */
printf("Enter marital status\n");
scanf(" %c", &mar);
/* printing places of service */
if(sex == 'F')
{
printf("\nYou will work only in urban areas");
}
if(sex == 'M')
{
if(age >= 20 && age < 40)
{
printf("\nYou may work anywhere");
}
else if(age >= 40 && age < 60)
{
printf("\nYou will work only in urban areas");
}
else
{
printf("\nERROR");
}
}
return 0;
}