Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

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 1-rupee & above 10 days fine is 5 Rs. If you return the book after 30 days your membership will be cancelled. Write a program to accept the no. of days the member is late to return the book & display the fine or the appropriate message.


Source Code :

#include<stdio.h>
void main()
{
      int n;
      clrscr();
      printf("\nEnter No. of Days : ");
      scanf("%d",&n);
      if(n<=5)
            printf("\nYour Fine is 0.50 Paise");
      else if(n>5 && n<=10)
            printf("\nYour Fine is Re. 1");
      else if(n>10 && n<=30)
            printf("\nYour Fine is Rs. 5");
      else
            printf("\nYour Membership is Cancelled");
      getch();
}

Output :

Enter No. of Days : 31

Your Membership is Cancelled

No comments:

Post a Comment