-If the driver is married.
-If the driver is unmarried, male & above 30 years of age.
-If the driver is unmarried, female & above 25 years of age.
In all other cases, the diver is not insured. If the marital status, gender, and age of the diver are inputs,write a program using logical operators to determine whether the driver is to be insured or not.
#include<stdio.h>
void main()
{
char ms,gendr;
int age;
printf("Enter driver's marital status,gender,age=");
scanf("%c %c %d",&ms,&gendr,&age);
if((ms=='M')||(ms=='u'&& gendr=='m'&& age>30)||(ms=='u'&& gendr=='f'&& age>25))
printf("Driver is ensured");
else
printf("Driver is not insured");
}
The output will be