Computer Science, asked by nahin66602, 2 months ago

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

Answers

Answered by chetanreddy839
1

Answer:

include<stdio.h>

#include<conio.h>

void main()

{

char name[20];

float unit,price,extra;

clrscr();

printf("\nEnter Consumer's name:");

gets(name);

printf("\nEnter units of electricity used:");

scanf("%f",&unit);

if(unit<=200)

{

price=(80*unit)/100 + 100;

puts(name);

printf("\nUnits = %.2f  Rate = 80 paise/unit  meter charges = 100 price = %.2f",unit,price);

}

else if(unit>200 && unit<=300)

{

extra=unit-200;

price=(80*unit)/100 + 90*extra/100 + 100;

puts(name);

printf("\nUnits = %.2f  Rate = 80 paise/unit for 200 units and 90 paise/unit above  meter charges = 100 price = %.2f",unit,price);

}

else if(unit>300 && unit <=400)

{

price=unit +100 ;

puts(name);

printf("\nUnits = %.2f  Rate = 1 rupees/unit  meter charges = 100 price = %.2f",unit,price);

}

else if(unit>400)

{

price=unit + unit*(15/100) + 100;

puts(name);

printf("\nUnits = %.2f  Rate = 1 rupees/unit  extra charges = 15/100 of total   meter charges = 100    price = %.2f",unit,price);

}

getch();

}

Similar questions