0% found this document useful (0 votes)
11 views2 pages

Electricity Bill

Uploaded by

hiremathsiddhant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Electricity Bill

Uploaded by

hiremathsiddhant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

//Electricity bill//

#include<stdio.h>
int main()
{
char username[50];
int unitsConsumed;
float totalAmount,surcharge=0;
printf("enter name:");
scanf("%s",&username);
printf("enter units consumed:");
scanf("%d",&unitsConsumed);

if(unitsConsumed<=200)
{
totalAmount=unitsConsumed*3.50+100;
}
else if(unitsConsumed<=300)
{
totalAmount=200*3.50+(unitsConsumed-200)*6+100;
}
else
{
totalAmount=200*3.5+100*6.0+(unitsConsumed-300)*10.5+100;
}
If(totalAmount>400)
{
surcharge=0.15*totalAmount;
totalAmount=totalAmount+surcharge;
}
printf("\n Owner name is: %s",username);
printf("\n Consumed unit: %d",unitsConsumed);
printf("\n Consumed unit %d bill is %f",unitsConsumed,totalAmount);
return 0;
}

You might also like