URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Learners Tech
  HTML https://learnerstech.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Question Board
       *****************************************************
       #Post#: 26--------------------------------------------------
       Question 4
   DIR By: MohanKestrel
       Date: July 16, 2017, 9:43 am
       ---------------------------------------------------------
       Objective
       Today's challenge puts your understanding of nested conditional
       statements to the test.
       Task
       Your local library needs your help! Given the expected and
       actual return dates for a library book, create a program that
       calculates  the fine (if any). The fee structure is as follows:
       1.If the book is returned on or before the expected return date,
       no fine will be charged (i.e.: fine=0).
       2.If the book is returned after the expected return day but
       still within the same calendar month and year as the expected
       return date,
       fine=15 rupees X Number of days late (i.e.,15 rupees per day
       fine)
       
       3.If the book is returned after the expected return month but
       still within the same calendar year as the expected return date,
       the
       fine=500 X number of months late.
       4.If the book is returned after the calendar year in which it
       was expected, there is a fixed fine of 1000 .
       Input Format
       The first line contains 3 space-separated integers denoting the
       respective day,month , and year on which the book was actually
       returned.
       
       The second line contains 3 space-separated integers denoting the
       respective day ,month , and year  on which the book was expected
       to be returned (due date).
       Constraints
       1<=D<=31
       1<=M<=12
       1<=Y<=3000
       Output Format
       Print a single integer denoting the library fine for the book
       received as input.
       Sample Input
       9 6 2015
       6 6 2015
       Sample Output
       45
       ans will be at 10.30pm today... Hurry to show your talents....
       #Post#: 27--------------------------------------------------
       Re: Question 4
   DIR By: Karthikeyan
       Date: July 16, 2017, 12:24 pm
       ---------------------------------------------------------
       No views....so ans will b posted tmrw aftrn
       #Post#: 28--------------------------------------------------
       Re: Question 4
   DIR By: MohanKestrel
       Date: July 17, 2017, 8:20 am
       ---------------------------------------------------------
       The answer is...
       #include<stdio.h>
       #include<conio.h>
       void main()
       {
       int i,j,k,a,b,c,d,e,f,g;
       clrscr();
       printf("enter the returned date of the book");
       scanf("%d %d %d",&i,&j,&k);
       printf("enter the bate of the book to be returned");
       scanf("%d %d %d",&a,&b,&c);
       if(k>c)
       {
       g=k-c;
       f=1000*g;
       }
       else if(j>b)
       {
       d=j-b;
       f=500*d;
       }
       else
       {
       e=i-a;
       f=15*e;
       }
       printf("the fine amount to be paid is %d",f);
       }
       *****************************************************
       Page 1 of 1