Computer Science, asked by Vaishnavi5583, 9 months ago

An electricity board charges the following rates for the use of electricity:
for the first 200 units 80 paise per unit
for the next 100 units 90 paise per unit
beyond 300 units Rs. 1 per unit.
All users are charged a minimum of Rs. 100 as meter charge.
If the total amount is more than Rs. 400, then an additional surcharge of 15% of total amount is charged.
Write a C program to read the name of the user, number of units consumed and print out the charges.

Answers

Answered by pavithranatarajan855
32

Answer:

#include <stdio.h>

void main()

{

float unit, charge;

printf("Enter unit Consumed:");

scanf("%f",&unit);

if(unit<125)

charge=100;

else if(unit<=200)

charge=unit*.80;

else if(unit<=300)

charge=(unit-200)*0.90+160;

else

if(unit>300)

charge=(unit-300)*1+250;

if(charge>=400)

charge=charge+charge*0.15;

printf("Charge: %5.2f",charge);

}

Similar questions