WAP in C that reads the customer number and power consumed and prints the amount to be paid by the customer.An electric power distribution company charges its domestic consumers as follows: Consumption Rate of Units Charge 0-200 Rs.0.50 per unit. 201-400 Rs.100 plus Rs.0.65 per unit excess 200. 401-600 Rs.230 plus Rs.0.80 per unit excess of 400.

#include<stdio.h>
#include<conio.h>
int main()
{
int cn,pu;
float amount;
clrscr();
printf(“Enter the customer number: “);
scanf(“%d”, &cn);
printf(“Enter the power consumed: “);
scanf(“%d”, &pu);
if (pu >= 0 && pu <= 200)

amount = pu * 0.50;

else if (pu > 200 && pu < 400)

amount = 100 + ((pu – 200) * 0.65);

else if (pu > 400 && pu <= 600)

amount = 230 + ((pu – 400) * 0.80);
printf(“\nAmount to be paid by customer no. %d is Rs.:%f”, cn, amount);
getch();
return(0);
}

Output :-

unit

Advertisements

2 thoughts on “WAP in C that reads the customer number and power consumed and prints the amount to be paid by the customer.An electric power distribution company charges its domestic consumers as follows: Consumption Rate of Units Charge 0-200 Rs.0.50 per unit. 201-400 Rs.100 plus Rs.0.65 per unit excess 200. 401-600 Rs.230 plus Rs.0.80 per unit excess of 400.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s