Library Management in C


This program is a simple program that calculates a fine for a library membership based on the number of days a book is overdue. The program prompts the user to input the number of days the book is overdue. It then uses a series of if-else statements to check the number of days and determine the appropriate fine. If the number of days is between 1 and 5, the fine is 0.50 paise, if it is between 6 and 10 the fine is 1 rupee, if it is between 11 and 29 the fine is 5 rupee and if the number of days is greater than 29 the membership will be canceled. The program then prints out the fine or the message that the membership will be canceled.


Source Code

/*
A library charges a fine for every book returned late.
For first 5 days the fine is 50 paise,
for 6-10 days fine is one rupee and
above 10 days fine is 5 rupees.
If you return the book after 30 days your membership will be cancelled.
Write a program to accept the number of days the member is late to return
the book and display the fine or the appropriate message.
 
*/
#include<stdio.h>
 
int main()
{
    int days;
    printf("\nEnter The Days : ");
    scanf("%d",&days);
    if(days>=1 && days<=5)
    {
        printf("\nFine Amount  0.50 Paise");
    }
    else if(days>=6 && days<=10)
    {
        printf("\nFine Amount  1 Rupee");
    }
    else if(days>=11 && days<=29)
    {
        printf("\nFine Amount  5 Rupee");
    }
    else
    {
        printf("\nmembership will be canceled");
    }
    return 0;
}
 
To download raw file Click Here

Output

Enter The Days : 15
Fine Amount  5 Rupee

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C