A company insures its drivers if either of the following conditions are satisfied
Input
#include<stdio.h>
void main()
{
char gender,ms;
int age;
printf("Enter Martial Status m For Married And u For Unmarried : ");
scanf("%c",&ms);
printf("\nEnter Gender m For Male And f For Female : ");
scanf("\n%c",&gender);
printf("\nEnter Age : ");
scanf("\n%d",&age);
if(((ms=='m'))||((ms=='u')&&(gender=='m')&&(age>30))||((ms=='u')&&(gender=='f')&&(age>25)))
printf("\nDriver Is Insured\n");
else
printf("\nDriver Is Not Insured\n");
}
Output
Enter Martial Status m For Married And u For Unmarried : u
Enter Gender m For Male And f For Female : f
Enter Age : 34
Driver Is Insured
- Driver is married.
- Driver is an unmarried, male and above 30 years of age.
- Driver is unmarried, female and above 25 years of age.
Input
#include<stdio.h>
void main()
{
char gender,ms;
int age;
printf("Enter Martial Status m For Married And u For Unmarried : ");
scanf("%c",&ms);
printf("\nEnter Gender m For Male And f For Female : ");
scanf("\n%c",&gender);
printf("\nEnter Age : ");
scanf("\n%d",&age);
if(((ms=='m'))||((ms=='u')&&(gender=='m')&&(age>30))||((ms=='u')&&(gender=='f')&&(age>25)))
printf("\nDriver Is Insured\n");
else
printf("\nDriver Is Not Insured\n");
}
Output
Enter Martial Status m For Married And u For Unmarried : u
Enter Gender m For Male And f For Female : f
Enter Age : 34
Driver Is Insured
No comments:
Post a Comment