Thursday, 17 March 2022

In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.

  #include


#include


int main()


{ char ms; 


 printf("Is Driver married (Y/N): ");


 scanf("%c",&ms); 


 if(ms=='y'||ms=='Y') printf("\nDriver is insured.");


 else if(ms=='n'||ms=='N'){ int age=0;


 char g; 


 printf("Enter gender of Driver (M/F): \n"); 


 scanf(" %c",&g); printf("Enter age of driver: ");


 scanf("%d",&age); 


 if((g=='m'||g=='M')&&age>=30) printf("\n Driver is insured.");


 else if((g=='f'||g=='F')&&age>=25) printf("\n Driver is insured.");


 else if(g=='m'||g=='M'||g=='f'||g=='F') printf("\n Driver is not insured."); 


 else{ printf("Please enter a valid gender of driver.\n"); 


 printf("Try again............");


 } 


 } 


 else{ printf("\nPlease Enter valid information."); 


 printf("Try again...........");


 } 


 getch();


 return 0; 


}

Featured post

In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.

  #include #include int main() { char ms;   printf("Is Driver married (Y/N): ");  scanf("%c",&ms);   if(ms=='y&#...

Popular Posts