Library Fine
A library charges a fine for every book returned late.For first 5 days the fine is 50paise,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
#include
void main(void)
{
clrscr();
int day;
printf("Enter the number of days late:");
scanf("%d",&day);
if(day<5)
{
printf("The fine is rupees 0.5");
}
else if(day<10)
{
printf("The fine is rupees 1");
}
else if(day>10&&day<30)
{
printf("The fime is rupees 5");
}
else if(day>30)
{
printf("Sorry,your membership has been cancled");
}
else
printf("Wrong input");
getch();
}
#include
#include
void main(void)
{
clrscr();
int day;
printf("Enter the number of days late:");
scanf("%d",&day);
if(day<5)
{
printf("The fine is rupees 0.5");
}
else if(day<10)
{
printf("The fine is rupees 1");
}
else if(day>10&&day<30)
{
printf("The fime is rupees 5");
}
else if(day>30)
{
printf("Sorry,your membership has been cancled");
}
else
printf("Wrong input");
getch();
}
Comments
Post a Comment