How To Write a C Program That Reads The Customer Number And Power Consumed And Prints The Amount To Be Paid By The Customer in C Programming Language ?
An electric power distribution company charges its domestic consumers as follows:Consumption Rate of Units Charge ------------------------------------------------------ 0-200 Rs.0.50 per unit 201-400 Rs.100 plus Rs.0.65 per unit excess 200 401-600 Rs.230 plus Rs.0.80 per unit excess of 400. -------------------------------------------------------
Solution For C Program That Reads The Customer Number And Power Consumed And Prints The Amount To Be Paid By The Customer.:
Tags: C Program That Reads The Customer Number And Power Consumed And Prints The Amount To Be Paid By The Customer.#include<stdio.h> #include<conio.h> void main() { int n, p; float amount; clrscr(); printf("Enter the customer number: "); scanf("%d",&n); printf("Enter the power consumed: "); scanf("%d",&p); if(p>=0 && p<=200) amount=p*0.50; else if(p>200 && p<400) amount = 100+((p-200) * 0.65); else if(p>400 && p<=600) amount = 230 + ((p-400) * 0.80); printf("Amount to be paid by customer no. %d is Rs.:%5.2f.",n,amount); getch(); }Output :Enter the customer number: 1 Enter the power consumed: 100 Amount to be paid by customer no. 1 is Rs.:50.00.
Learn More :
C Program
- Using Bash to input stuff into c program
- Difficult C Programming Questions
- Write a c program to find largest among three numbers using binary minus operator three numbers using binary minus operator
- PRINTING ASCII VALUE USING C PROGRAM
- MULTIPLICATION OF TWO MATRICES USING C PROGRAM
- FIND OUT SUM OF DIAGONAL ELEMENTS OF A MATRIX USING
- Write A C Program To Find Out Transport Of A Matrix
- Factorial of 100 in C Program
- Multiplication of large numbers in c
- Division of Large Numbers in C Program
- BINARY SEARCH USING C PROGRAM
- BINARY SEARCH THROUGH RECURSION USING C PROGRAM
- FIND FACTORIAL OF A NUMBER USING RECURSION IN C PROGRAM
- FIND GCD OF A NUMBER USING RECURSION IN C PROGRAM
- FIND SUM OF DIGITS OF A NUMBER USING RECURSION USING C PROGRAM
- FIND POWER OF A NUMBER USING RECURSION USING C PROGRAM
- REVERSE A NUMBER USING RECURSION IN C PROGRAM
- SWAP TWO VARIABLES WITHOUT USING THIRD USING C PROGRAM VARIABLE
- Write A C Program For Swapping Of Two Arrays
- SWAPPING OF STRINGS USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION OF DECIMAL TO BINARY USING C PROGRAM
- CONVERSION OF FAHRENHEIT TO CENTIGRADE USING C PROGRAM
- C or C++ Program To Find Bonus Amount