Answer to Question #4353 in C++ for kishen naik

Question #4353
a company ensures a driver in the following cases:
1)if the driver is married.
2)if the driver is unmarried, male and above 30 years of age.
3)if the driver is unmarried, female and above 25 years of age.
in all other cases the driver is not ensuredif the marriable date is 6 and age of the driver are the input . write a program to determine when driver is ensured or not.
1
Expert's answer
2011-10-06T09:29:58-0400
#include <stdio.h>
#include <stdlib.h>

char GetEnsered(char Mar,char male,char Year)
{
& if((Mar=='Y')||(Mar=='y'))
& {
return 0;
& }
& else
& {
if(((male=='Y')||(male='y'))&&((Year>=30)))
{
& return 0;
}
else if(Year>=25) return 0;
else return 1;
& }
}

int main()
{
int i=0;
while(i==0)
{
& char Mar,male;
& int Year=0;
& printf("Enter drivers data:\n Is driver married? (Type Y or N):");
& scanf("%c",&Mar);
& printf("Is he male? ( Type Y or N):");
& scanf("%c",&male);
& printf("How old is driver?(Enter number above 0):");
scanf("%d",&Year);
& if(GetEnsered(Mar,male,Year)==0) printf("Driver is ensured\n\n");
else printf("Driver is not ensured\n\n");
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS