Program for Electricity Billing System in C-Language

Tutorial Title: Program for Electricity Billing System in C-Language

First 200 units / unit price = Rs 4
Acceding from 200 units next 200 unites / unit price = Rs 6
Acceding from 400 units / unit price = Rs 8
Note:  Range of price and unit can be changed

Course: Programming

Instructor: Muhammad Samim

Note: Do not copy code from here may be it does not work due to font style coding.
Download Code Here

Code for understanding:
#include<stdio.h>
#include<conio.h>

int main()
{
float a; // Making variable "a" to store consumed units
printf("Please Enter consumed Units:   ");
scanf("%f",&a); // Storing input units (any number) in variable "a"
if (a<=200) // If unites are less than or equal to 200 then
printf("\n\nTotal units price = %2.2f:\n\n",a*4); //What number will be in variable "a" will be
                                                                                       multiply with 4 and result will be shown

        else if (a<=400) // If units are less than or equal to 300 then
printf("\n\nTotal units price = %2.f:\n\n",(a-200)*6+200*4); //200 units will be minus from
                                                                                                         variable "a" and remaining
                                                                                                         units will be multiplied  with 6, 
                                                                                                         200 units will be multiplied with 
                                                                                                         4 and the result will be added with
                                                                                                         previous result  according to
                                                                                                         DMAS
else if (a>400) // If units are greater than 400 then
printf("\n\nTotal units price = %2.f:\n\n",(a-400)*8+200*4+200*6); //400 units will be minus
                                                                                                                     from variable "a"
                                                                                                                     and remaining units will be
                                                                                                                     multiplied with 8, 200 units
                                                                                                                     will be multiplied with
                                                                                                                     4,  200 units will be
                                                                                                                     multiplied with 6 and all
                                                                                                                     results will be sum 
                                                                                                                     according to DMAS

getch ();
}










SHARE

Muhammad Samim

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment