C Programming: electricity bill

Posted on:
tags: , ,


Q-6: Write a program to calculate and print electricity bill for consumers, given the following information: service number, previous meter reading, and current reading.
#include<stdio.h>
#include<conio.h>
void main()
{
                int pre,c,sn;

                float bill_amt,pre_amt,unit;

                clrscr();
                printf("\t\tWelcome To Kolkata Electricity Board\n");
                printf("\n\n ENTER SERVICE NUMBER:");
                scanf("%d",sn);
                printf("\nENTER THE PREVIOUS MONTH READING UNIT USED:");
                scanf("%d",&pre);
                printf("\nENTER THE CURRENT MONTH READING UNIT USED:");
                scanf("%d",&c);
                                pre_amt=pre*2.5;
                                bill_amt=c*2.5;
                printf("\nCustomer With SERVICE NUMBER:%d",sn);
                printf("\n\t\tCustomer's Previous Bill Amount:%f",pre_amt);
                printf("\n\t\tCustomer's Current Bill Amount:%f",bill_amt);

                getch();
}

No comments:

Post a Comment

< >