Saturday, May 21, 2011

C Program to implement telephone billing System

/*Code to accept 10 telephone customers’ data into a structure
object.
The fields are:
Customer name
Telephone number
Units to be billed
Calculate Bill Amount, which is Rent of Rs. 250 plus Re 0.80 for each
unit. Prepare the Bill and print it.*/


int main()
{
int n,i;
struct bill
{
char name[20];
int num;
int units;
}a[50];


printf("\nEnter the no of customers");
scanf("%d",&n);
for(i=0;i {
printf("\nEnter the customer's name");
scanf("%s",&a[i].name);
printf("\nEnter the customer's number");
scanf("%d",&a[i].num);
printf("\nEnter the no of units");
scanf("%d",&a[i].units);
}
for(i=0;i {
printf("\nname %s",a[i].name);
printf("\nnumber %d",a[i].num);
printf("\nBill is Rs %f",((a[i].units)*0.8)+250);



}
system("pause");
return 0;
}

No comments:

Post a Comment