From d7036a36bd95a34594cbfd4a30bd25bb1562bb88 Mon Sep 17 00:00:00 2001 From: Milan Singhal <114495538+milansinghal@users.noreply.github.com> Date: Sat, 15 Oct 2022 11:52:03 +0530 Subject: [PATCH] electricitybillgenerator.c A program to generate electricity bills by inputting the number of units consumed. --- C/electricitybillgenerator.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 C/electricitybillgenerator.c diff --git a/C/electricitybillgenerator.c b/C/electricitybillgenerator.c new file mode 100644 index 0000000..37f7c7e --- /dev/null +++ b/C/electricitybillgenerator.c @@ -0,0 +1,35 @@ +#include +int main() +{ + int unit; + int c=0; + printf("Enter the number of units consumed : "); + scanf("%d",&unit); + + if(unit<=50) + { + printf("Bill is: "); + c+=(unit*0.2)+(unit*0.50); + printf("%d",c); + } + else if (unit<=150) + { + printf("Bill is: "); + c+=(unit*0.2)+(unit*0.75); + printf("%d",c); + } + else if (unit<=250) + { + printf("Bill is: "); + c+=(unit*0.2)+(unit*1.20); + printf("%d",c); + } + else + { + printf("Bill is: "); + c+=(unit*0.2)+(unit*1.50); + printf("%d",c); + } +   return 0; + +}