×

# include<stdio.h>

int main() {int x; float y; scanf("%d",&x); scanf("%f",&y); if(x>=y) printf("%.2f",y); else { if(x%5==0) {y=y-(float)x-0.50; printf("%.2f",y);} else printf("%f",y); } }

1★md_1083
0
accept rate: 0%

1★arun_as
7413618

 0 Please post a link to your solution and to the question as well. Nobody can understand your code this way. Edit: I have resubmitted your code by adding return 0 at the end of the main function. The answer is still wrong. I hope you can find the reason on your own :) http://www.codechef.com/viewsolution/6774066 answered 13 Apr '15, 22:21 223●3 accept rate: 0%
 0 First of all, please provide a proper solution link and a link to the problem. Secondly, you have made a lot of mistakes in your code. 1) Put \n when printing the result 2) When comparing int with a floating point number use typecasting as shown in the code below 3) x can be 0 as well. At such point, the bank should not deduct any money. In your code the bank is still deducting 0.50$4) Also, when x is divisible by 5, you have to check whether x+0.50 is greater than y or not.  include< stdio.h> int main() { int x; float y; scanf("%d",&x); scanf("%f",&y); if((float)x>=y) printf("%.2f\n",y); else if(x==0) printf("%.2f\n",y); else { if(x%5==0) { if(y>(float)x+0.50) y=y-(float)x-0.50; printf("%.2f\n",y); } else printf("%.2f\n",y); } }  answered 14 Apr '15, 12:18 893●2●11●35 accept rate: 10%  toggle preview community wiki: Preview ### Follow this question By Email: Once you sign in you will be able to subscribe for any updates here By RSS: Answers Answers and Comments Markdown Basics • *italic* or _italic_ • **bold** or __bold__ • link:[text](http://url.com/ "title") • image?![alt text](/path/img.jpg "title") • numbered list: 1. Foo 2. Bar • to add a line break simply add two spaces to where you would like the new line to be. • basic HTML tags are also supported • mathemetical formulas in Latex between$ symbol

Question tags:

×1,490
×190

question asked: 13 Apr '15, 22:09

question was seen: 518 times

last updated: 14 Apr '15, 12:18