A library charges a fine for every book returned late.
For first 5 days the fine is 50 paisa,
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>
#include <conio.h>
void main ( )
{
int day;
clrscr ( );
printf ("\n Enter the number of days the member is late to return the book..:"); scanf ("%d",&day);
if( day < 0 )
{
printf ("\n Invalid input.");
}
else if ( day == 0 )
{
printf ("\n No fine required.");
}
else if ( day >= 1 && day <= 5 )
{
printf ("\n You have to pay fine of 50 paise.");
}
else if ( day <= 10 )
{
printf("\n You have to pay fine of one rupee.");
}
else
{
printf("\n You have to pay fine of 5 rupees.");
}
if ( day >= 30 )
{
printf ("\n YOUR MEMBERSHIP IS CANCELLED.");
}
getch ( );
}
No comments:
Post a Comment