Monday, 24 July 2017

Write a program to output whether the person should be insured or not

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 using operators.

   
  An Insurance company follows following rules to calculate premium. 
·        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 gender 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.
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.

Code:

#include<stdio.h>
#include<conio.h>
void main()
{
char h,l,g;
int a;
printf("Enter Heath e For Excellent And p For Poor ");
scanf("%c",&h);
printf("Enter Location c For City And v For Village ");
scanf("\n%c",&l);
printf("Enter Gender m For Male And f For Female ");
scanf("\n%c",&g);
printf("Enter Age ");
scanf("\n%d",&a);
if((h=='e')&&(l=='c')&&(g=='m')&&(a>=25&&a<=35))
printf("\nThe Premium Is Rs.4 Per Thousand And His Policy Cannot Exceed Rs.2 Lakhs");
else if((h=='e')&&(l=='c')&&(g=='f')&&(a>=25&&a<=35))
printf("\nThe Premium Is Rs.3 Per Thousand And Her Policy Cannot Exceed Rs.1 Lakhs");
else if((h=='p')&&(l=='v')&&(g=='m')&&(a>=25&&a<=35))
printf("\nThe Premium Is Rs.6 Per Thousand And Cannot Exceed Rs. 10,000");
else
printf("\nNot Insured");
getch();
clrscr();
}

Output:


Try it yourself.
If you have any problem you can tell me on comment box i will help you.
thanks.

Viral Programs

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment