Thursday, February 18, 2021

 #include <stdio.h>

int main()
{

    float unitschargesbill;
    float taxamount;

    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:

HackCache ’26: A 48-Hour Online Hackathon Open to Every Student

  Hackathons are often associated with computer science students, experienced developers, and teams that already know exactly what they are...

Popular Posts