7 kyu
Simple Fun #181: Rounding
257 of 636myjinxin2015
Loading description...
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.
python new test framework is required. updated in this fork
Approved
C# tests generate warnings -->
tests/Fixture.cs(106,15): warning CS0219: The variable 'passed' is assigned but its value is never used
No sample tests in PHP
Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update
Enabled in this fork + Tests cleanup
This comment has been hidden.
Because you are asked to do so.
nice kata to understand how to cast, especially if you are learning many languages at once
PHP Translation :P
OK,thanks ;-)
i thought it would take me less time to solve this than it actualy took :D,cool one!
"If n is exactly in the middle of 2 multiples of m, return n instead." When I saw this sentence first time,I was really confused. I thought for several minutes and finally understood it. The test cases and error info help me a lot.
Is that a trick statement? In the middle means 1/2 the value. If n = 1/2 * (2 * m) return n. In other words, if n equals m, since the 1/2 and doubling cancel each other out?
What I have is the conditions that if either n or m are 0 then return 0, n * m is 0. And also if m is larger than or equal to n then return n? Is that correct?
(n * m) == 0 return 0 n <= m return n
You can ignore this sentence firstly and write code as you expect. Then submit and care about the error info and test cases.