+ 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.
11 ответов
+ 2
Ok but your problem is a very simple one
+ 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
+ 1
okay keep in touch... because i have many questions about c program
+ 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");
}
}
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
0
ok i try again
0
aint working
0
Post code in coding section so you can run it easly (You know how do it?)
0
its done
0
the charges of 8 days must be 550..
yeah that's the real Question..