## C Programming

### Calculate the library penalty charges

#### Objective

Input the number of days from the issue date of a book. A library decided to penalty charges on an issuing book after 7 days of issue. The penalty charges are as given below

1. For the first five delays, 50 paise/day.
2. For delay of 6-20 days, 1 Rs/day.
3. For delay of 20-30 days, 5 Rs/day.
4. For delay more than 30 days, 10 Rs/day.

Calculate the penalty charges of the book.

#### Program / Solution:

```#include<stdio.h>
int main() {
int days,delay;
float penalty ;
printf("Enter the issue days of a book: ");
scanf("%d",&days);

delay = days - 7;
if(delay <= 0) {
penalty = 0;
}else if(delay <= 5) {
penalty = delay * 0.50f;
}else if(delay <= 20) {
penalty = delay * 1;
}else if(delay <= 30) {
penalty = delay * 5;
}else {
penalty = delay * 10;
}

printf("Issue days = %d\n",days);
printf("Delay days = %d\n",delay);
printf("Penalty = %.2f\n",penalty);

return 0;
}
```

#### Sample Output:

```Enter the issue days of a book: 25
Issue days = 25
Delay days = 18
Penalty = 18.00
```