#include <stdio.h>
int main()
{
float units, charges, bill;
float tax, amount;
printf(" enter the unit consumed: ");
scanf(" %f", &units);
if (units >= 0 && units <= 50.0)
{
charges = 0.5;
bill = charges * units;
tax = bill * 0.2;
amount = bill + tax;
printf("\n your bill is rupees: %f\n", bill);
printf("\n tax on your bill is rupees :%f\n", tax);
printf("\n therefore your total amount is rupees: %f\n\n", amount);
}
else if (units > 50.0 && units <= 150.0)
{
charges = 0.75;
bill = charges * units;
tax = bill * 0.2;
amount = bill + tax;
printf("\n your bill is rupees: %f\n", bill);
printf("\n tax on your bill is rupees :%f\n", tax);
printf("\n therefore your total amount is rupees: %f\n\n", amount);
}
else if (units > 150.0 && units <= 250.0)
{
charges = 1.20;
bill = charges * units;
tax = bill * 0.2;
amount = bill + tax;
printf("\n your bill is rupees: %f\n", bill);
printf("\n tax on your bill is rupees :%f\n", tax);
printf("\n therefore your total amount is rupees: %f\n\n", amount);
}
else if (units > 250.0)
{
charges = 1.50;
bill = charges * units;
tax = bill * 0.2;
amount = bill + tax;
printf("\n your bill is rupees: %f\n", bill);
printf("\n tax on your bill is rupees :%f\n", tax);
printf("\n therefore your total amount is rupees: %f\n\n", amount);
}
else
{
printf("units doesnt satisfy condition therfore bill generated is not correct");
}
return 0;
}
No comments:
Post a Comment