Ad
  • Custom User Avatar

    I immediately had the solution in mind. Almost the exact same problem was solved in CS50 Python. Good problem to understand the use of % sign

  • Custom User Avatar
  • Custom User Avatar

    lol, yeah the only error I was getting was that I couldn't make the % operation between an int and a double so I just switched the double with int and it started working, but giving the opposite reult. Thx for the response!

  • Custom User Avatar

    You changed the function to take an int instead of a double, and it ended up really screwing up the tests. You're supposed to return true if n is even, but your code really broke this kata.

  • Custom User Avatar

    I was able to do it, but I am very confused. Am I returning True if the number is odd and False if the number is even?? Because from the Kata name I thought it would be the opposite, and now I'm contemplating if I ever understood C at all.

  • Custom User Avatar

    But you didn't provide the error. By looking at the code, I think that conversions are problematic. "int" datatype may not be accurate enough.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Approved by Johan

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    sorry officer hobovsky, i should've put my question in questions, please dont arrest me

  • Custom User Avatar

    @DeCaTou: you can print the input to console to see which test is failing. In your case it is n = 500000000000.

  • Custom User Avatar

    "My solution does not work" is not a valid kata issue. If you want to raise an issue, you have to tell what is wrong with the kata.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Not a kata suggestion, OP solved it, closing...

  • Loading more items...