Each day I solve several challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, but you will learn a ton of new and interesting things as you go.
This is a nice and easy challenge. We are given three numbers (A, B, C), who are then used in a mathematical expression. The result of the expression is stored in variable R.
The buggy line we have is: let R = (βοΈ + B + C) / π§;
We also know that R = 5 (it's given), now we have to determine what βοΈ and π§ should be. Since we have two unknowns but only one equation, we have to make a calculated guess. We see that A+B+C = 15
. And since R has to be 5, then we can π§ be 3, which is a possible answer in this case.
Note: we can ignore the Math.floor(R)
code, it's used for rounding down decimal numbers; since 15 is a whole number it's irrelevant.
Great! On to the next one.
If you feel inspired and motivated to upgrade your coding + debugging skills, join me on the Road to Genius at https://nevolin.be/codr/
Top comments (0)