Thursday, October 29, 2020

C program of electricity bill

 #include <stdio.h>

int main() {

    int u;

    printf("Enter units consumed:");

    scanf("%d",&u);

    if(u<=100)

        printf("Net Bill=%d",u);

    else if(u<=200)

        printf("Net Bill=%d",100+(u-100)*1);

    else if(u<=300)

        printf("Net Bill=%d",250+(u-200)*2);

    else if(u<=400)

        printf("Net Bill=%d",500+(u-300)*3);

    else

        printf("Net Bill=%d",750+(u-400)*5);

}

No comments:

Post a Comment

What If They Misunderstood You? ❤️ | How I Handle Misunderstandings

https://youtube.com/shorts/I09jcicjGnA   Right. [clears throat] So I want to share that over the time I have realized that you there is a hi...