Answer:
#include <stdio.h>
#define MAXIMUM_LOAN_PERIOD 14
#define FINE_RATE 0.20
#define SEPARATOR "----------------"
int main() {
double amountFined;
int numberOfBooks, daysLoan, daysOverdue;
printf(SEPARATOR "\\BOOK LOAN SYSTEM\\" SEPARATOR "\\");
printf("Enter the number of books : ");
scanf("%d", &numberOfBooks);
printf("Enter the days of the loan : ");
scanf("%d", &daysLoan);
printf(SEPARATOR SEPARATOR SEPARATOR "\\");
daysOverdue = daysLoan - MAXIMUM_LOAN_PERIOD;
amountFined = FINE_RATE * numberOfBooks * daysOverdue;
printf("Days overdue : %d\\", daysOverdue);
printf("Fine : RM %.2f\\", amountFined);
return 0;
}
Step-by-step explanation:
Reading integers can be done using scanf. What is missing in this code is checking for bad input, but the happy flow works!