Вы находитесь на странице: 1из 4

EXP.

NO:2(a) DATE:

ROLL NO:11no36 NAME:PREETHI.R PREMIUM CALCULATION

Question: An insurance company follows following rules to calculate premium. 1. If a persons 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. 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 persons 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. 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 Aim: To write a program for calculating the premium rate and maximum amount can be insured. Algorithm: Step 1:Start the program. Step 2:Declare the variables h,s,l,a. Step 3:Read the values for h,s,l,a.

EXP.NO:2(a) DATE:

ROLL NO:11no36 NAME:PREETHI.R

Step 4:Check whether h is equal to excellent,age is between 25 and 35,g is male and l is city and goto step 8. Step 5: Then check whether h is excellent,age is between 25 and 35, g is female and l is City and goto step 9. Step 6:Again check whether h is poor,age is between 25 and 35,g is male and l is Village and goto step 10. Step 7:The condition is not satisfied the person cannot insure. Step 8:Print the premium amount is Rs.4 per thousand and the policy amount cannot exceed 2 lakhs. Step 9:Print the premium amount is Rs.3 per thousand and the policy amount cannot exceed 1 lakh. Step 10:Print the premium amount is Rs.6 per thousand and cannot exceed Rs.10,000. Step 11:Terminate the program. Program Coding: /*INSURANCE*/ #include<stdio.h> #include<conio.h> main() { int a,h,s,l; clrscr();

EXP.NO:2(a) DATE:

ROLL NO:11no36 NAME:PREETHI.R

printf("\t\t\tINSURANCE\n\nEnter the health condition(1 for excellent and 2 for poor):"); scanf("%d",&h); printf("Enter the age:"); scanf("%d",&a); printf("Enter the sex(1 for female and 2 for male):"); scanf("%d",&s); printf("Enter the location of the person(1 for village and 2 for city):"); scanf("%d",&l); if((h==1)&&((a>=25)&&(a<=35))&&(l==2)&&(s==2)) printf("\n\nHe can insure\nHis premium rate is Rs.4 per thousand\nHis maximum amount can be insured is Rs. 2 Lakhs"); else if((h==1)&&((a>=25)&&(a<=35))&&(l==2)&&(s==1)) printf("\nShe can insure\nHer premium rate is Rs.3 per thousand\nHer maximum amount can be insured is Rs.1 Lakh"); else if((h==2)&&((a>=25)&&(a<=35))&&(l==1)&&(s==2)) printf("\nHe can insure\nHis premium rate is Rs.6 per thousand\nHis maximum amount can be insured is Rs.10000"); else printf("\n\nThe person cannot insure"); getch(); } Output:

EXP.NO:2(a) DATE: Result:

ROLL NO:11no36 NAME:PREETHI.R

Thus the premium rate and maximum amount are found using C-program.

Вам также может понравиться