Posts

C program to accept customer details

Write a ‘C’ program to accept customer details such as: Account_no, Name, Balance in account, Assume Maximum 20 customers in the bank. Write a function to print the account no and name of each customer with balance below Rs.100. Solution:- #include<stdio.h> #include<conio.h> struct customer { int accno; char cname[20]; int bal; }; void disp(struct customer * , int); void main() { struct customer c[20]; int i,n; clrscr(); printf("\nHOW MANY CUSTOMER U WANT"); scanf("%d",&n); printf("\nENTER THE ACCNO,CNAME,BAL"); for(i=0;i<n;i++) { scanf("%d%s%d",&c[i].accno,&c[i].cname,&c[i].bal); } disp(&c[0],n); getch();   }   void disp(struct customer *d,int n)   {     int i;     for(i=0;i<n;i++)     { if(d[i].bal<100) { printf("\n%d\t%s",d[i].accno,d[i].cname); }     }  }

C program menu drive example

Write a menu driven program in ‘C’ that shows the working of a library. The menu option should be - Add book information. - Display book information. - List all books of given author. - List the count of books in the library. - Exit. (Using Structure Array) #include #include struct book { int bno; char bname[20],author[20]; }; void main() { struct book b[10]; int i,n,m; char t[10]; clrscr(); do { printf("\n1.ADD BOOK INFORMATION"); printf("\n2.DISPLAY BOOK INFORMATION"); printf("\n3.LIST ALL BOOKS OF GIVEN AUTHOR"); printf("\n4.TOTAL NO OF BOOKS IN LIBRARY"); printf("\n5.EXIT"); printf("\nENTER UR CHOICE"); scanf("%d",&m); switch(m) { case 1: printf("\nHOW MANY BOOKS WANT"); scanf("%d",&n); printf("\nENTER THE BNO,BNAME & AUTHOR"); for(i=0;i { scanf("%d%s%s",&b[i].bno,&b[i].bname,&b[i].author); } break; case 2: printf("\nBOOK DETAILS \n...