logo CodeStepByStep logo


Language/Type: C# algorithms interview
Related Links:

Write a method named SumCubes that accepts an integer n as a parameter and prints all unique combinations of values in the range [1, n] for which the following equality is true:

a3 + b3 = c3 + d3

For example, if n is 20, your method should print the following output:

1^3 + 12^3 = 9^3 + 10^3
2^3 + 16^3 = 9^3 + 15^3

The lines may appear in any order but must follow this exact format.

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.