Skip to content
Related Articles

Related Articles

E -Library Management System

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 15 Mar, 2021

In this article, we will discuss the approach to create an E-Library Management System where the user has the following options:

  • Add book information.
  • Display book information.
  • To list all books of a given author.
  • To list the count of books in the library.

Functionalities Required:

  • If the user tries to add a book then the user must have to provide the below specific Information about the book as:
    • Enter Book Name:
    • Enter Author Name:
    • Enter Pages:
    • Enter Price:
  • When the user tries to display all books of a particular author then the user must have to enter the name of the author:
    • Enter the author name:
  • The E-Library management System must be also capable of counting all the books available in the library.

Below is the program to implement the E-Library Management System:


// C program for the E-library
// Management System
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Create Structure of Library
struct library {
    char book_name[20];
    char author[20];
    int pages;
    float price;
// Driver Code
int main()
    // Create a instance
    struct library lib[100];
    char ar_nm[30], bk_nm[30];
    // Keep the track of the number of
    // of books available in the library
    int i, input, count;
    i = input = count = 0;
    // Iterate the loop
    while (input != 5) {
               "WELCOME TO E-LIBRARY "
        printf("\n\n1. Add book infor"
               "mation\n2. Display "
               "book information\n");
        printf("3. List all books of "
               "given author\n");
            "4. List the count of book"
            "s in the library\n");
        printf("5. Exit");
        // Enter the book details
        printf("\n\nEnter one of "
               "the above: ");
        scanf("%d", &input);
        // Process the input
        switch (input) {
        // Add book
        case 1:
            printf("Enter book name = ");
            scanf("%s", lib[i].book_name);
            printf("Enter author name = ");
            scanf("%s", lib[i].author);
            printf("Enter pages = ");
            scanf("%d", &lib[i].pages);
            printf("Enter price = ");
            scanf("%f", &lib[i].price);
        // Print book information
        case 2:
            printf("you have entered"
                   " the following "
            for (i = 0; i < count; i++) {
                printf("book name = %s",
                printf("\t author name = %s",
                printf("\t  pages = %d",
                printf("\t  price = %f",
        // Take the author name as input
        case 3:
            printf("Enter author name : ");
            scanf("%s", ar_nm);
            for (i = 0; i < count; i++) {
                if (strcmp(ar_nm,
                    == 0)
                    printf("%s %s %d %f",
        // Print total count
        case 4:
            printf("\n No of books in "
                   "brary : %d",
        case 5:
    return 0;


  • Displaying the functoionalities and input for option 1:
  • For Choice 2 and 3:
  • For choice 4 and 5:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!