Skip to main content
Write a program to create a list of books details. The details of a book include title, author, publisher, publishing year, number of pages, and price.
CODING:
#include <stdio.h>
#include<conio.h>
void main()
{
 struct book{
  char title[20],author[30],pblctn[20];
  int pages,pbyear,price;
 }book;
 clrscr();

 printf("Book Details\n------------\nTitle : ");
 flushall(); gets(book.title);
 printf("Author : ");
 flushall(); gets(book.author);
 printf("Publisher : ");
 flushall(); gets(book.pblctn);
 printf("Pages : ");
 flushall(); scanf("%d",&book.pages);
 printf("Publishing Year : ");
 flushall(); scanf("%d",&book.pbyear);
 printf("M.R.P. (Rs.) : ");
 flushall(); scanf("%d",&book.price);

 clrscr();
 printf("\nBook Details\n------------\nTitle\t\t : %s\n",book.title);
 printf("Author\t\t : %s\n",book.author);
 printf("Publisher\t : %s\n",book.pblctn);
 printf("Pages\t\t : %d\n",book.pages);
 printf("Publishing Year\t : %d\n",book.pbyear);
 printf("M.R.P. (Rs.)\t : %d",book.price);

 getch();
}

Comments