7 kyu
Return the closest number multiple of 10
3,395 of 7,363brunolm
Loading description...
Mathematics
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
JS err: expected 1678 to equal 1670, well...
For which input? Anyway, your returned 1678 is clearly not a multiple of 10.
As I understood: if input = 1678, output = 1680. And I don't know what happened, bcoz my solution gives exactly this result but according to the test it should equal 1670. :)
the js ref sol returns 1680 for input 1678
Idk, in my case some random tests failed because they expected wrong value (expected 1670 for 1678 as input)
Wrong. I already tried to hint you that the first number is what you returned, the second number is the expected value, the input is unknown. To figure out the input you can log it to console: an example how it's done in python - https://docs.codewars.com/training/troubleshooting/#print-input
Please review and approve, thanks !
Approved
Lua translation!
NASM translation
Approved
This kata does not specify:
Negative numbers have been removed in C. Are there other katas including them? If there are not, I don't think rounding is a problem as long as it is the default rounding mode in each language.
I checked all languages. Only C included negative numbers.
approv2d
COBOL translation.
approved
C translation (author inactive)
Approved :)
.
Haskell : https://www.codewars.com/kumite/5ba701c86432cf6274000456?sel=5ba701c86432cf6274000456
There are issues in TypeScript version. For 10 to 14 return 10 but expected 20. Can anyone correct the testcases?
I can't see this error. Can you post your solution so we can try to reproduce it?
This comment has been hidden.
This comment has been hidden.
Python- I tested by using jupyter.
Input: 22 Output: 20
But still got the error '22 should get 20' when ran suite.
PHP Translation Kumited - please accept :D
This comment has been hidden.
I totally forgot that on C# you need
MidpointRounding.AwayFromZero
. I believe this is now fixedYap, it's fixed!
Ruby translation submitted. Hope it's ok.
And Crystal too.
Ruby accepted.
Hmm, please see my comment on Crystal translation
Last one :) CoffeeScript translation.
Please accept when you find the time :) Thanks
Can you round your input number to integer(in random tests)? It looks very strange ;-)
I thought about it, but what if someone takes
7.7
and converts to10.7
? That would be wrong right?I know this is not an issue(I choose label "suggestion"), just think it's looks strange ;-)
I agree with myjinxin2015. It could be clarified in the description that floats are allowed. Some examples in the description for this would be good too.