Answer to Question #270424 in C for Cess

Question #270424

In order to discourage excess electric


consumption, an electrical company charges


its customers a lower rate of P75 for the


first 250 kilowatt-hours and a higher rate


of P8.5 for each additional kilowatt-hour.


In addition, a 10% surtax is added to the


final bill. Write a program that calculates


the electrical bill given the number of


kilowatt-hours consumed as input. At the end,


print the number of kilowatt-hours consumed


and the computed bill

1
Expert's answer
2021-11-24T00:43:17-0500
#include<stdio.h>
#include<conio.h>
int main(){
    int units = 0, total = 0 , extraUsed = 0;
    printf("\n ---Electricity bill charges are given below based on the consumptions----- ");
    printf("\n 1.For first 250 kilowatt-hour, electricity charge is 7.5P per unit ");
    printf("\n 1.For those user who are using above 250 kilowatt-hour, electricity charge is 8.5P additional kilowatt-hour");
    printf("\n 10% surtax for each");


    printf("\ Enter the units of electricity used by the user:");
    scanf("%d",&units);
    printf("\n Total electricity consumption is: %d",units);
    if(units <= 250){
      total=units*7.5;


    }else{


       extraUsed = units-250;
       total = units*7.5 + extraUsed*8.5;
    }
    total = total+total*0.1;
    printf("\ Total electricity bill is: %d",total);


return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS