5
|
Write a C program to calculate
the amount to be paid by a customer for electricity bill.
Where Unit Consumed = Current
meter reading – Past meter reading and
Total Bill = Unit Consumed *
Charge per unit
Input: customer number,
customer name, past reading (in units), present reading (in units), charge
per unit
Output: (Print with same format
shown here)
Electricity Bill
---------------------------------------------------------
Customer Number : *****
Customer Name : **********************
Past Reading : ********
Current Reading : ********
Units Consumed : ********
Charge Per Unit : **.**
Amount to be paid (Rs.) : ******.**
----------------------------------------------------------
|
#include<stdio.h>
#include<conio.h>
void main()
{
int
cusno,total,start,stop,reading,charge;
char cusname[20];
clrscr();
printf("Enter The
Customer No=");
scanf("%d",&cusno);
flushall();
printf("Enter The
Customer Name=");
scanf("%[^\n]",cusname);
printf("Enter The
Starting And Ending Reading=");
scanf("%d%d",&start,&stop);
printf("Enter The Charge
Of Unit=");
scanf("%d",&charge);
reading=stop-start;
total=reading*charge;
printf("\n\n\n\t\tThe
Customer No Is=%d",cusno);
printf("\n\t\tThe
Customer Name Is=%s",cusname);
printf("\n\t\tThe
Starting Reading Is=%d",start);
printf("\n\t\tThe Ending
Reading Is=%d",stop);
printf("\n\t\tThe Total
Reading Is=%d",reading);
printf("\n\t\tThe Total
Bill You Have To Pay Is=%d",total);
getch();
}
Comments
Post a Comment