Description: An Insurance company follows following rules to calculate premium.
#include<conio.h>
int main()
{
char health,sex,area;
int age;
printf("Enter health condn(e/p),sex(m/f),area(c/v)&age\n");
scanf("%c %c %c %d",&health,&sex,&area,&age);
if(health=='e'&&sex=='m'&&area=='c'&&age>=25&&age<=35)
{
printf("\nInsured\n");
printf("\nPremium rate = Rs. 4 per 1,000\n");
printf("\nmaximum policy amount = Rs. 2,00,000");
}
else
if(health=='e'&&sex=='f'&&area=='c'&&age>=25&&age<=35)
{
printf("\nInsured");
printf("\nPremium Rate = Rs. 3 per 1000");
printf("\nMaximum policy amount = Rs. 1,00,000");
}
else
if(health=='p'&&sex=='m'&&area=='v'&&age>=25&&age<=35)
{
printf("\nInsured");
printf("\nPremium Rate = Rs. 6 per 1,000");
printf("\nMaximum policy amount = Rs. 10,000");
}
else
printf("\nYou cannot be insured\n");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
- If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.
- 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.
- If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.
- In all other cases the person is not insured.
Code
#include<stdio.h>#include<conio.h>
int main()
{
char health,sex,area;
int age;
printf("Enter health condn(e/p),sex(m/f),area(c/v)&age\n");
scanf("%c %c %c %d",&health,&sex,&area,&age);
if(health=='e'&&sex=='m'&&area=='c'&&age>=25&&age<=35)
{
printf("\nInsured\n");
printf("\nPremium rate = Rs. 4 per 1,000\n");
printf("\nmaximum policy amount = Rs. 2,00,000");
}
else
if(health=='e'&&sex=='f'&&area=='c'&&age>=25&&age<=35)
{
printf("\nInsured");
printf("\nPremium Rate = Rs. 3 per 1000");
printf("\nMaximum policy amount = Rs. 1,00,000");
}
else
if(health=='p'&&sex=='m'&&area=='v'&&age>=25&&age<=35)
{
printf("\nInsured");
printf("\nPremium Rate = Rs. 6 per 1,000");
printf("\nMaximum policy amount = Rs. 10,000");
}
else
printf("\nYou cannot be insured\n");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.