lease write a program in C for this and mail it back
as soon as possible!!!!
The problem goes lke this
There is an insurance company.They insure their
members on the following basis:
1>)He shud b a male and between 25 and 35 years of age
who resides in a town and with excellent health
condition.Then he is insured and gets and incentive of
4 per thousand.
2.)If all the above conditions are agreed and the
person is a female then then she gets
and incentive of 3 per thousand
3.)IF he is 25 to 35 years of age and a male with poor
health condition and resides in a
village then he gets an incentive of 2 per thousand
4.) if not he gets no incentive
Get the age , city , sex , health from the member and
print if he is insured or not and print
his/her incentive respectively.
Use only int and char. no functions to be used.
USE C - FOR CITY,V - FOR VILLAGE,FOR HEALTH USE E FOR EXCELLENT AND P FOR POOR FOR SEX USE M FOR MALE AND F FOR FEMALE
THIS IS THE PROGRAM THAT I TRIED
#include <stdio.h>
#include <conio.h>
void main()
{
int age;
char sex,health,stay;
scanf("%d%c%c%c",&age,&stay,&health,&sex);
if((sex=='M'||sex=='F')&&(age>=25&&age<=35)&&(stay =='C'||stay=='V')&&(health=='E'||health=='P')
{
printf("you are eligible for insurance");
if(sex=='M' && (age>=25&&age<=35) && stay=='C' && health=='E')
printf("your insurance incentive is 4 per thousand");
if(sex=='F' && (age>=25&&age<=35) && stay=='C' && health=='E')
printf("your insurance incentive is 2 per thousand");
if(sex=='M' && (age>=25&&age<=35) && stay=='V' && health=='P')
printf("your insurance incentive is 2 per thousand");
}
else
printf("you are not eligible for insurance");
}
the error i get is whenever i run the program and enter the values irrespectively i get the output as you are not eligible.