Computer Science, asked by noorpree2323, 9 months ago

An electricity .company charge its.
consumers according to the units
consumed per month as per the given
traff


unit consume
per unit to100
Rs 2.50
More than 100 units to 200 units
Rs 3.80

More than 200 units
Rs 6.90


In adition to the above every
consumer has to pay Rs 200 A
service charge
per month write
a program to input the amount
of units consumed and calculate
the total
total charges
payable
(Bill)
by the consumer.​

Answers

Answered by kaursimranpreet1980
5

Answer:

Program to calculate the electricity bill taking consumer’s name and units consumed as inputs.

Explanation:

A program in C to calculate and print the Electricity bill of a given customer.

#include <stdio.h>

#include <string.h>

int main()

{

float chg, unit,consume;

char cust_name[25];

printf("Input the name of the customer :");

scanf("%s", cust_name);

printf("Input the unit consumed by the customer : ");

scanf("%f",&unit);

if (unit <200 )

chg = 3.80;

else if (unit>=200 && unit<=300)

chg = 4.40;

else if (unit>300 && unit<=400)

chg = 5.10;

else

chg = 5.80;

consume = unit*chg;

printf("\nElectricity Bill\n");

printf("Customer Name : %s\n",cust_name);

printf("unit Consumed : %.3f\n",consume);

return 0;

}

Output

Input the name of the customer :Simran

Input the unit consumed by the customer : 350

Electricity Bill Customer Name : Simran

unit Consumed : 1785.000

3.0

Explanation:

Hope it helps you

please mark me braineist and follow me....

Answered by pavansaik
6

Answer:

import java.util.Scanner;

class ElectricBill

{

   static void main ()

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter Number of Units Consumed:");

       int x;

       x=sc.nextInt();

       double a=2.0, b=1.8, c=1.5;

       System.out.println("Service charge - 200 Rs");

       if (x<=100){

           System.out.println("Units Consumed=" +x);

           System.out.println("2 Rs per unit");

           System.out.println("Total Charge=");

           System.out.println(a*x+200);

       }

       else if (x>100){

           System.out.println("Units Consumed=" +x);

           System.out.println("1.8 Rs per unit");

           System.out.println("Total Charge=");

           System.out.println(b*x+200);

       }

       else if (x>200){

           System.out.println("Units Consumed=" +x);

           System.out.println("1.5 Rs per unit");

           System.out.println("Total Charge=");

           System.out.println(c*x+200);

       }

   }

}

   

Explanation:

This is the easiest way of doing this program without complication.

Hope you found the answer helpful.

Keep learning!!!

Similar questions