-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkseb.c
More file actions
40 lines (39 loc) · 860 Bytes
/
kseb.c
File metadata and controls
40 lines (39 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
struct kseb
{
int consid,unit,total;
char name[20];
}bill[10];
void read(struct kseb[],int);
void main()
{
int n,i;
printf("Enter number of consumers :");
scanf("%d",&n);
read(bill,n);
printf("/////////////////////DETAILS//////////////////\n");
for(i=0;i<n;i++)
{
printf("CONSUMER %d\n",i+1);
printf("CONSUMER NAME : %s\n",bill[i].name);
printf("CONSUMER ID : %d\n",bill[i].consid);
printf("UNITS CONSUMED %d\n",bill[i].unit);
printf("TOTAL CHARGE : %d\n",bill[i].total);
printf("\n");
}
}
void read(struct kseb temp[10],int num)
{
int i;
for(i=0;i<num;i++)
{
printf("CONSUMER %d\n",i+1);
printf("Enter consumer ID :");
scanf("%d",&temp[i].consid);
printf("Enter name of the consumer :");
scanf("%s",&temp[i].name);
printf("Enter units of electricity used by the consumer :");
scanf("%d",&temp[i].unit);
temp[i].total=temp[i].unit*10;
}
}