Computer Science, asked by supanthachowdhury11, 4 months ago

An electricity board charges the bill depending on the number of units consumed as follows :

Units Charges

First 100 units 40 P per unit

Next 200 units 60 p per unit

Above 300 units
Rs. 1 per unit

Write a C Program
to print the net bill to be paid by a consumer.​

Answers

Answered by pavansaik
2

Write a Java Program

to print the net bill to be paid by a consumer.

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=0.40, b=0.60, c=1.0;

     

       if (x<=100)

{

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

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

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

           System.out.println(a*x);

       }

       else if (x,200)

{

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

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

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

           System.out.println(b*x);

       }

       else if (x>300)

{

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

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

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

           System.out.println(c*x);

       }

   }

}

   

Explanation:

This is the Easiest way to write the program without complication.

Hope you found it useful!!!

Keep Learning!!!

Similar questions