You are not logged in. Please login at www.codechef.com to post your questions!

×

ATM problem, second easiest question on this site, where on gods green earth am I going wrong?!?!

So below is my code, there's a test case in there somewhere which invalidates my code, but I can't see it, and it's driving me nuts.

include "stdio.h"

int main() { int x = 0; float y=0; float charge = 0.5;

scanf("%d%f",&x,&y);
if ((x>y) || (x % 5 != 0) || (x>2000) || (x<1) || (y<0) || (y>2000))

{

printf("%0.2f",y) ;
return 0;

}

float result = (y-x-charge); printf("%0.2f",result); return 0;

}

asked 17 Feb '15, 23:16

ishyataullah's gravatar image

0★ishyataullah
11
accept rate: 0%


Check your code for the input:

1000 1000.3

You are missing some check conditions in your code. Read the question carefully once again and try debugging. The correct output should be 1000.299988

link

answered 17 Feb '15, 23:47

damn_me's gravatar image

3★damn_me
2.6k21336
accept rate: 24%

toggle preview
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,477
×190

question asked: 17 Feb '15, 23:16

question was seen: 1,474 times

last updated: 17 Feb '15, 23:47