Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKunal Jarodia
402 PointsI am completely lost on the part 2 to this question,
How would I show Part 2 ? I am so lost thank you for your help in advance! :)
// Enter your code below
let value = 200
let divisor = 5
let result = value/divisor
let someOperation = 20 + 400 % 10 / 2 - 15
let anotherOperation = 52 * 27 % 200 / 2 + 5
let isPerfectMultiple =
1 Answer
Anjali Pasupathy
28,883 PointsPart 1 of the task asks you to find the remainder when you divide value by divisor, not the quotient. Because of this, you need to use the mod operator when calculating result, not the division operator.
let result = value/divisor // USE %, NOT /
After this, Part 2 asks you to assign to isPerfectMultiple a bool that is true when result is equal to 0, and false when result is not equal to 0. The expression "result == 0" evaluates to true when result is 0, and false when result isn't 0; thus, this is the expression you need to assign to isPerfectMultiple:
let isPerfectMultiple = result == 0
I hope this helps!
Kunal Jarodia
402 PointsKunal Jarodia
402 PointsThank you very much! I realised about part 1 as soon as I wrote that but thank you for your help!! :)
Anjali Pasupathy
28,883 PointsAnjali Pasupathy
28,883 PointsYou're welcome!