Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please write in C. its due at 12pm central time so need help before then please.

ID: 3586075 • Letter: P

Question

please write in C. its due at 12pm central time so need help before then please.

Electricity bill Write a program that reads the electricity consumption (in kWh) and computes the electricity bill based on the following conditions: The first 50 kWh costs 8.5 cents/kWh Next 100 kWh costs 9.5 cents/kWh Next 100 kWh costs 9.8 cents/kWh The consumption above 250 kWh costs 10.25 cents/kWh Additional surcharge 20% is added to the bill. The program will print the total amount in U.S. dollars. Example of input: 303 Corresponding output: The total bil is $34.78

Explanation / Answer

#include <stdio.h>
#include <math.h>
int main()
{
int c;
double cost = 0;
printf("Enter the electrocity consumption: ");
scanf("%d", &c);
cost = 8.5;
if(c > 50) {
cost = cost + 9.5;
}
if(c > 150) {
cost = cost + 9.8;
}
if(c > 250) {
cost = cost + 10.25;
}
cost = cost + cost * 0.2;
printf("The total bill is $%lf ", cost);
return 0;
}

Output: