Ad

Chapter - 3: The Decision Control

A library charges a fine for every book returned late. For the first 5 days, the fine is 50 paise, for 6-10 days fine is one rupee and above 10 days fine is 5 rupees. If you return the book after 30 days your membership will be canceled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.


Ad
G
Sections
4
Exercises
#include<stdio.h>
#include<conio.h>
int main()
{
	float chrg;
	int lat;
	
	printf("Enter the days you're late : ");
	scanf("%d", &lat);
	
	if(lat<=5)
		chrg=0.50;
		
	if(lat>5 && lat<11)
		chrg=1.0;
	
	if(lat>10 && lat<31)
		chrg=5.0;
		
	if(lat>30)
		printf("\n\nYour library membership has been cancelled de to over delay to returning the book.");
		
	printf("\n\nYour library charges are Rs. %f", chrg);
	
	getch();
	return 0;
}
Ad

© 2024 Garbage Valuegarbage value logo