The aim of this challenge is to write a few algorithms to solve the following Maths puzzles:
In order to solve these puzzles, we will use an iterative approach using nested loops to test all possible combinations of two numbers until we find a match.
You will first look at the code used to solve the following puzzle and then tweak this code to solve the puzzles listed above.
Iterative Approach using nested loops…
Here is our code based on nested loops to test all possible pairs of numbers between 0 and 1,000.