0% found this document useful (0 votes)
3 views5 pages

C LAB 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

C LAB 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

C LAB 6

Problem 1: Write a C program to create an application for the following. A computer


generator id is generated by reading an integer N using an array. But no duplicate is allowed
so identify the duplicate element and print the unique id. Write a function to perform the
above by passing n and the array of ids to function.

Code:
Output:

Problem 2: Write a program in C to calculate and print the electricity bill of a given
customer using a function. The customer ID, name, and unit consumed by the user is read and
passed to the function from the keyboard to display the total amount to be paid to the
customer using call by value. Use the Unit slab for calculating the bill.

The charge is as follow:


Unit Charge/unit

upto 199 @1.20

200 and above but less than 400 @1.50

400 and above but less than 600 @1.80

600 and above @2.00

If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill should
be of Rs. 100/-

customer ID -123
Name - John
Unit – 453
Amount to be Paid: Rs. 931.84

customer ID -131
Name - Bob
Unit – 75
Amount to be Paid:100

Code:
Output:

You might also like