Previous Next
0 / 13
Module DEMO-32-56DEMO-C-32

Library Book Fine Checker

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that helps a library determine if a book return is overdue and whether a fine should be applied.

A reader borrowed a book and must return it within 14 days. If they return it after 14 days, they owe a fine of $5. Your program should read the number of days since the book was borrowed and output whether a fine is due.

This simulates a real-world scenario where libraries automatically check returns against due dates to apply fines.

Constraints

The number of days will be an integer between 0 and 30 (inclusive) Only use one if statement and one else statement Do not use else if or nested conditions

Input Format

The input consists of a single integer representing the number of days since the book was borrowed.

Output Format

Print exactly one of the following messages:

  • "Fine due: $5" (without quotes) if the book is returned after 14 days
  • "No fine" (without quotes) otherwise

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
10
No fine
The book was returned within 14 days, so no fine is due.
Sample #2
Public sample
15
Fine due: $5
The book was returned after 14 days, so a $5 fine is due.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings