Challenge 19 - Calculating The Difference Between Squares Image Challenge 19 - Calculating The Difference Between Squares

In this challenge, you are going to implement the DiffSquares function so that it returns the difference between the first number squared minus the second number squared.

5^2 - 4^2 = 9

If you require a hint as to how this is done, please click below:

Hint

You can calculate powers of numbers in Go using the math.Pow function. You can read more about this here: Math Pow

See the Solution

Feel free to have a look at the forum discussion thread for this challenge and contribute with your own solutions here - Challenge 19 - Diff of Squares

Further Reading:

If you like this challenge then you may also appreciate some of the following articles on the site:


Other Challenges