Skip to main content

electri

HTML
<p>
#include
void main()
{
int units;
float charges;
char name[20];
printf("Enter the name of the customer\n");
scanf("%s",name);
printf("Enter the units consumed\n");
scanf("%d",&units);
charges=100;
if(units>0&&units<=200)
charges=charges+0.8*units;
else if (units>200&&units<=300)
charges=charges+0.8*200+(300-units)*0.9;
else
charges=charges+0.8*200+100*0.9+(units-300)*1;
if(charges>400)
charges=charges+0.15*charges;
printf("name=%s\n",name);
printf("units consumed=%d\n",units);
printf("charges=%f\n",charges);
}
</p>

Comments

Popular posts from this blog

Raju is a Civil Engineer. He is writing software to automate his work. As a part of his requirement, he wants to calculate the circle diameter, circumference, and area. Help Raju to complete his task. Get radius as input.

OUTPUT

Seetha, a maths teacher has started to learn the C programming language. She writes a program to do basic arithmetic operations. Help Seetha to complete her first program.

OUTPUT