Chapter 2 Program 11

Also visit our YouTube Channel Tech Eos    VISIT CHANNEL


/*  11. The ABC Insurance Company Ltd. Offers the following three
   categories of car insurance policy to car owners:
~ Category A, here the basic premium is calculated as 2% of the car's value.
~ Category B, here the basic premium is calculated as 3% of the car's value.
~ Category C, here the basic premium is calculated as 5% of the car's value.
*/

#include<stdio.h>
#include<conio.h>

void main()
{
float car_price;
char category;

clrscr();

printf("\n\nEnter your car's price  :  ");
scanf("%f" , &car_price );

printf("\n\nA. 2 percentage premium");
printf("\nB. 3 percentage premium");
printf("\nC. 5 percenteage premium");

flushall();

printf("\n\nEnter your category  :  ");
scanf("%c" , &category );

if( category == 'A' || category =='a' )
{
printf("\n\nCar's premium is %f" , car_price*0.02);
}
else if( category == 'B' || category == 'b' )
{
printf("\n\nCar's premium is %f" , car_price*0.03);
}
else if( category == 'C' || category == 'c' )
{
printf("\n\nCar's premium is %f" , car_price*0.05);
}
else
{
printf("\n\nSelect an valid option");
}


getch();
}

Comments

Popular posts from this blog

Maximum from three numbers (Nested If ) (Chapter 2 Program 2 )

( Chapter 2 Program 7 )

Modular operator in c ( Chapter 1 Program 9)