POP Using C - VTU Lab Program-3
POP Using C - VTU Lab Program-3
3. An electricity board charges the following rates for the use of electricity: for the first 200
units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units Rs 1 per unit. All
users are charged a minimum of Rs. 100 as meter charge. If the total amount is more than Rs 400,
then an additional surcharge of 15% of the total amount is charged. Write a program to read the
name of the user, the number of units consumed, and print out the charges.
Algorithm:
Step 1: START
Step 2 : Read the name of the user
Step 3: Read the number of units consumed
Step 4: Initialize the minimum meter charge as 100
Flowchart:
Program:
#include <stdio.h>
void main()
char name[10];
scanf("%s", name);
}
Command to execute the Program:
$ gcc lab3.c -lm
$ ./a.out
Output:
Case 1:
Name: Keerthi
MeterCharge: 260.000
Case 2:
Name: Anika