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 trialViktor Kondin
Courses Plus Student 1,084 PointsBad formulation of task
Task: Create a variable named "ten" and assign the correct numeric value 10 to it using only variables a, b, and c and the common numeric operators.
Actually there are several variants to receive value 10, but as I Understand - validator can read only 1 of them.
5 Answers
Jacob M.
5,122 PointsI don't think it matters as long as it results in the value 10.
So ten = b + c + c should work but ten = b * c + b should also work.
Jason Anello
Courses Plus Student 94,610 PointsYou mean something like 3 * a
?
You're not allowed to use them for this exercise. You can't use any number literals. Only the variables and numeric operators.
As Jacob mentions, there's different ways to get the answer and they all should work as long as you only use what's allowed.
Viktor Kondin
Courses Plus Student 1,084 PointsBut what about coefficients? There are no information about using them.
Viktor Kondin
Courses Plus Student 1,084 Points2 Jason,
Exactly. Now it is clear, but I think it will be better to clarify for customer, that using of coefficient are not allowed, because formulation " using only variables a, b, and c and the common numeric operators" for me does not make clear, that coefficients are also not allowed.
In any case, thank you for great job. it is the best portal for learning I have ever seen.
Emilio Queiroz
3,710 PointsQ: Create a variable named "ten" and assign the correct numeric value 10 to it using only variables a, b, and c and the common numeric operators.
Below is only calculate:
var a = 1,
b = 2,
c = 4;
Then the answer is: Easy..!
var a = 1,
b = 2,
c = 4;
var ten=(b*c)+(b*a);