Thursday, October 8, 2009

Determine if eligible for premium & Policy

/*An Insurance company follows rules to calculate premium

1)If a person's health is excellent and the person is btw. 25 & 35 years of age and lives in city and is a male then the premium is Rs 4 per thousand and his policy amount cannot exceed Rs 2 lakhs.

2)If a person satisfies all the above conditions except that the sex is female then the premium is Rs 3 per thousand and her policy amount cannot exceed Rs 1 lakh.

3)If a person's health is poor and the person is btw. 25-35 and lives in village and is male ,the premium is Rs 6 per thousand and his policy cannot exceed Rs 10,000

4)In all other cases the person is not insured

Write a program to output whether the person should be insured or not ,his/her premium rate and maximum amount for which he/she can be insured.*/

#Solution
=======

#include <stdio.h>
int main(void)
{
int age,pre,policy_amt;
char sex,live,health;
printf("Enter your age : ");
scanf("%d",&age);
if ( age <= 35 && age >= 25)
{
printf("\nPl.enter your health status ( h/p- h(healthy),p(poor health): ");
scanf(" %c",&health);
printf("\nDo you live in city/Village(c=city)(v=village): ");
scanf(" %c",&live);
printf("\nAre you Male/Female(m=male,f=female : ");
scanf(" %c",&sex);

if ( health == 'h')
{
if ( sex == 'm'&& live == 'c')
printf("\nYou are opt for Rs 4/- Preminum over 1000 Rs & Policy not greater than 2 lakh");
else if ( sex == 'f'&& live == 'c')
printf("\nYou are opt for Rs 3/- Preminum over 1000 Rs & Policy not greater than 1 lakh");
}
else if ( live == 'v' && sex == 'm')
printf("\nYou are opt for Rs 6/- Preminum over 1000 Rs & Policy not greater than 10,000 Rs/-");

if ( sex == 'm' && live == 'c' && health == 'p')
printf("\nSorry no premium or Policy for you");
if ( sex == 'm' && live == 'v' && health == 'h')
printf("\nSorry no premium or Policy for you");
if ( sex == 'f' && live == 'v' && ((health == 'h') || (health == 'p' )))
printf("\nSorry no premium or Policy for you");
if ( sex == 'f' && live == 'c' && health == 'p')
printf("\nSorry no premium or Policy for you");
}

else
printf("\nYou are not eligible for Premium or Policy");

return 0;
}






No comments: