C Program to Calculate Electricity Power Bill

 #include<stdio.h>

void main()

{

    int units;

    int unitcost;

    int bill;


    printf("Enter the number of units: ");

    scanf("%d",&units);


    if(units <= 30)

        unitcost = 1;

    else if(units <= 50)

        unitcost = 2;

    else if(units <= 100)

        unitcost = 3;

    else

        unitcost = 10;


    bill = units * unitcost;


    printf("Total Power Bill = %d",bill);

}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices