# Library Fine code in C#

Problem source: https://www.hackerrank.com/challenges/library-fine

The Head Librarian at a library wants you to make a program that calculates the fine for returning the book after the return date. You are given the actual and the expected return dates. Calculate the fine as follows:

1. If the book is returned on or before the expected return date, no fine will be charged.
2. If the book is returned in the same month as the expected return date, Fine = 15 Hackos × Number of late days
3. If the book is not returned in the same month but in the same year as the expected return date, Fine = 500 Hackos × Number of late months
4. If the book is not returned in the same year, the fine is fixed at 10000 Hackos.

Input Format

You are given the actual and the expected return dates in D M Y format respectively. There are two lines of input. The first line contains the D M Y values for the actual return date and the next line contains the D M Y values for the expected return date.

Constraints
1D31
1M12
1Y3000

Output Format

Output a single value equal to the fine.

Sample Input

9 6 2015
6 6 2015


Sample Output

45

class Library_Fine_Hackerrank
{
static void Main(string[] args)
{
int[] arrActual = Console.ReadLine().Split(‘ ‘).Select(x => Convert.ToInt32(x)).ToArray();
int[] arrExpected = Console.ReadLine().Split(‘ ‘).Select(x => Convert.ToInt32(x)).ToArray();

if (arrActual[2] > arrExpected[2])
{
Console.WriteLine(10000);
}
else if (arrActual[2] == arrExpected[2])
{
if (arrActual[1] > arrExpected[1])
{
Console.WriteLine(500 * Math.Abs(arrActual[1] – arrExpected[1]));
}
else if (arrActual[1] == arrExpected[1])
{
if (arrActual[0] <= arrExpected[0])
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(15 * Math.Abs(arrActual[0] – arrExpected[0]));
}
}
else if (arrActual[1] < arrExpected[1])
{
Console.WriteLine(0);
}
}
else if (arrActual[2] < arrExpected[2])
{
Console.WriteLine(0);
}