Tuesday 24 December 2013

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<iostream>
 using namespace std;
#include<conio.h>
int main()
{

  int nu_days;
 
  cout<<"Enter the number of nu_days the member is late to return the book : ";
  scanf("%d",&nu_days);
  if(nu_days<=5)
    cout<<"\nYou mpay 50 Rupes fine..."; // '\n' is used for new line
  else if(nu_days>=6&&nu_days<=10)
    cout<<"\nYou pay 1 Rupee fine...";
  else if(nu_days>10&&nu_days<30)
    cout<<"\nYou  pay 5 Rupees fine...";
  else if(nu_days>=30)
    cout<<"\nYour membership is cancell...";
  getch();
  return 0;
}

No comments:

Post a Comment