A company insure its drivers in the following cases: -
If the driver is married.
If the driver is unmarried, male and above thirty years of age.
If the driver is unmarried, female and above twenty five years of age.
In all other cases the driver is not insured. If the marital status, sex, and age of driver are inputs through the keyboard, write a program to determine whether the driver is to be insured or not.
#include <stdio.h>
#include <conio.h>
void main( )
{
char sex, ms;
int age;
clrscr ( );
printf ("\n Enter age of driver.......................:"); scanf ("%d",&age);
fflush (stdin); /* For cliearing input buffer */
printf ("\n Enter sex of driver.......................:"); scanf ("%c",&sex);
fflush (stdin); /* For cliearing input buffer */
printf ("\n Enter marital status of driver.........:"); scanf ("%c",&ms);
if((ms == 'M')||(ms == 'U' && sex == 'M' && age > 30)||(ms == 'U' && sex == 'F' && age > 25 ))
printf("\n DRIVER IS INSURED");
else
printf("\n DRIVER IS NOT INSURED");
getch ( );
}
To contact us
If the driver is married.
If the driver is unmarried, male and above thirty years of age.
If the driver is unmarried, female and above twenty five years of age.
In all other cases the driver is not insured. If the marital status, sex, and age of driver are inputs through the keyboard, write a program to determine whether the driver is to be insured or not.
#include <stdio.h>
#include <conio.h>
void main( )
{
char sex, ms;
int age;
clrscr ( );
printf ("\n Enter age of driver.......................:"); scanf ("%d",&age);
fflush (stdin); /* For cliearing input buffer */
printf ("\n Enter sex of driver.......................:"); scanf ("%c",&sex);
fflush (stdin); /* For cliearing input buffer */
printf ("\n Enter marital status of driver.........:"); scanf ("%c",&ms);
if((ms == 'M')||(ms == 'U' && sex == 'M' && age > 30)||(ms == 'U' && sex == 'F' && age > 25 ))
printf("\n DRIVER IS INSURED");
else
printf("\n DRIVER IS NOT INSURED");
getch ( );
}
To contact us
No comments:
Post a Comment