#include<stdio.h>
#include<conio.h>
void main()
{
float car;
char category;
clrscr();
printf("ABC insuarance company ltd. offers:");
printf("\n\ncategory A, here the basic premium is calculated as 2%c
of the car's value",37);
printf("\ncategory B, here the basic premium is calculated as 3%c
of the car's value",37);
printf("\ncategory C, here the basic premium is calculated as 5%c
of the car's value",37);
printf("\n\nenter category: ");
scanf("%c",&category);
printf("\nenter car value: ");
scanf("%f",&car);
switch(category)
{
case 'A': car = car * 2 / 100;
printf("\npremium is: %0.2f",car);
break;
case 'B': car = car * 3 / 100;
printf("\npremium is: %0.2f",car);
break;
case 'C': car = car * 5 / 100;
printf("\npremium is: %0.2f",car);
break;
default : printf("\nenter valid value");
}
getch();
}
/* output:
category A, here the basic premium is calculated as 2107370f the car's value
category B, here the basic premium is calculated as 3107370f the car's value
category C, here the basic premium is calculated as 5107370f the car's value
enter category: A
enter car value: 100000
premium is: 2000.00
*/
No comments:
Post a Comment