write a c program to input electricity unit charges and calculate the total electricity bill according to the given condition: for first 50 units rs. 0.50/unit for next 100 units rs. 0.75/unit for next 100 units rs. 1.20/unit for unit above 250 rs. 1.50/unit an additional surcharge of 20% is added to the bill
Answers
Answered by
28
include<stdio.h>
main()
{
int units;
float at=0,sch=0,tx=0;
printf("Enter number of units ");
scanf("%d",&units);
if(units<=50)
at=units*0.50;
else if(units>50 && units<=150)
at=25+((units-50)*0.75);
else if(units>150 && units<=250)
at=75+((units-150)*1.20);
else if(units>250)
at=195+((units-250)*1.50);
sch=(20*at)/100;
tx=(10*at)/100;
printf("------------------------------...
printf("TOTAL Units %d\n ", units);
printf("Unit charges %5.2f\n",at);
printf("fuel surchage(20%) %5.2f\n",sch);
printf("Govt. Tax (10%) %5.2f ",tx);
printf("------------------------------...
printf("Total Amount %5.2f",at+sch+tx);
printf("------------------------------...
}
main()
{
int units;
float at=0,sch=0,tx=0;
printf("Enter number of units ");
scanf("%d",&units);
if(units<=50)
at=units*0.50;
else if(units>50 && units<=150)
at=25+((units-50)*0.75);
else if(units>150 && units<=250)
at=75+((units-150)*1.20);
else if(units>250)
at=195+((units-250)*1.50);
sch=(20*at)/100;
tx=(10*at)/100;
printf("------------------------------...
printf("TOTAL Units %d\n ", units);
printf("Unit charges %5.2f\n",at);
printf("fuel surchage(20%) %5.2f\n",sch);
printf("Govt. Tax (10%) %5.2f ",tx);
printf("------------------------------...
printf("Total Amount %5.2f",at+sch+tx);
printf("------------------------------...
}
Answered by
2
The first step is to set the equations for gravitational potential energy and work equal to each other and solve for force. W = PE is F × d = m × g × h, so F = (m × g × h) ÷ d. The second and final step is to plug the values from the problem into the equation for force.
Similar questions