+ 1

How? in c

A library charges a fine for every book returned late for first five days is 50 rupees/day. From 6th to 10th day fine is 100 rupees/day and above 10 days is 200 rupees/day and if you returned the book after 30 days then your membership will be cancelled. Write a program that accept the numbers of days a student is late in returning the books and prints the appropriate message.

29th Apr 2018, 11:59 AM
Jordan
Jordan  - avatar
11 Antworten
+ 2
Ok but your problem is a very simple one
29th Apr 2018, 12:43 PM
KrOW
KrOW - avatar
+ 2
Your calculation are wrong:... Suppose that x are late days then: if x is 5 or less you must add x * 10 to charge and if x >5 and x<=10 you must ADD (x-5)*100 of charge (here you must handle x greater than 10 because it sum up to charges also) and if x >10 you must ADD (x-10)*200 of charge and if x>30 you must cancel membership also P.S. You can add code to code section and link in discussion
29th Apr 2018, 1:22 PM
KrOW
KrOW - avatar
+ 1
okay keep in touch... because i have many questions about c program
29th Apr 2018, 12:18 PM
Jordan
Jordan  - avatar
+ 1
Jordan like Andrew G telled you, you can get help on code (or ideas) but dont ask to do that it seem a school work to community... Write your code in code section and link it here so we can help you
29th Apr 2018, 12:32 PM
KrOW
KrOW - avatar
+ 1
not working properly #include <stdio.h> int main() { int time; printf("enter time"); scanf("%d",&time); if (time<=5){ time=50/time; printf("%d",time);} for(time=6;time<=10;time++){ time=100/time; printf("%d",time);} if (time>10){ time=200/time; printf("%d",time);} if (time>30){ printf("your membership is cancelled"); } }
29th Apr 2018, 1:00 PM
Jordan
Jordan  - avatar
0
thanks Andrew..KrOw yeah you are right but actually it takes so time to think what it should be.. My exam are so close so i put my questions here
29th Apr 2018, 12:40 PM
Jordan
Jordan  - avatar
0
ok i try again
29th Apr 2018, 1:30 PM
Jordan
Jordan  - avatar
0
aint working
29th Apr 2018, 1:41 PM
Jordan
Jordan  - avatar
0
Post code in coding section so you can run it easly (You know how do it?)
29th Apr 2018, 1:43 PM
KrOW
KrOW - avatar
0
its done
29th Apr 2018, 3:22 PM
Jordan
Jordan  - avatar
0
the charges of 8 days must be 550.. yeah that's the real Question..
4th May 2018, 11:26 AM
Jordan
Jordan  - avatar