Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Kai Huang
9,369 PointsMy answer is wrong but I think it is correct
Is there anything wrong with my code?

Kai Huang
9,369 PointsOh sorry, Didn't notice I didn't add the code in. Do let me know why this answer isn't working. Thanks!
def mod(a, b)
return "The remainder of #{a} divided by #{b} is #{a%b}"
end

Jordan Gauthier
5,552 PointsI haven't learned ruby yet, but could it be that you are attempting to get the remainder of a / c rather than a / b?
Instead of #{a%c}, should it instead be #{a%b}?
2 Answers

Kai Huang
9,369 PointsAh I have found out the mistake, apparently I need to set
c = a % b
first before inserting #{c} into the puts statement

Jason Anello
Courses Plus Student 94,592 PointsMy answer came in a little late here but you don't need to create a c
variable. What you had posted above was fine with the exception of the missing period.

Jason Anello
Courses Plus Student 94,592 PointsHi Kai,
The only issues is that you're missing a period to end the sentence. The challenge is looking for an exact match on the string and the example in the instructions has a period at the end.
Sometimes the challenges are a little lenient and will accept answers without things like periods but the best thing to do is always try to match the output exactly.
Justin Horner
Treehouse Guest TeacherJustin Horner
Treehouse Guest TeacherHello Kai,
Please post your code so we can check it out.