Problem Description: The Electricity Officer has mentioned the total counts of unit and amount. The officer inform the customer the bill amount in a unique The format given by electricity officer as follow: But customers are finding the difficult to find the exact amount that needs to be paid. Can you help the customers Functional Description: Total Bill Amount unitconsumed ^ costperunit Constraints: 1 s unitconsumed s 500 blem ब/ 2 s costperunits 10 Input Format : The first line of input represents the integer value of unitconsumed The second line of input represents the integer value of costperunit Output Format: Print the total Bill amount in single line. v Logical Test Cases Test Case 1 Test Case 2
Answers
Answer:
you mark me brainlist and i will give sure answer
Total Bill Amount unit consumed ^ cost per unit Constraints: 1 s unit consumed s 500 blem ब/ 2 s cost per units 10
Input Format : The first line of input represents the integer value of unit consumed
The second line of input represents the integer value of cost per unit Output Format: Print the total Bill amount in single line.
Explanation:
#include <stdio.h>
int main()
{
int unit;
float amt, total_amt, sur_charge;
printf("Enter total units consumed: ");
scanf("%d", &unit);
if(unit <= 50)
{
amt = unit * 0.50;
}
else if(unit <= 150)
{
amt = 25 + ((unit-50) * 0.75);
}
else if(unit <= 250)
{
amt = 100 + ((unit-150) * 1.20);
}
else
{
amt = 220 + ((unit-250) * 1.50);
}
sur_charge = amt * 0.20;
total_amt = amt + sur_charge;
printf("Electricity Bill = Rs. %.2f", total_amt);
return 0;
}