+ 1
Write a program to find the sum of perfect square of a given number. If perfect square doesn't exist return False.
For example If the given number is 13 then 2^2 + 3^2 =13. So Ans is 2 and 3.
2 Antworten
+ 1
If you can return boolean then you can return the numbers too. Free to use any language and return type but satisfy the question as result should be perfect square.
0
I don't think returning a boolean instead of a number is a bad Idea! One should find other solutions like returning 0 or -1.
Because:
User:"What numbers is it?"
Function:"No."
Makes no sense...
And in many languages you have to choose what type you'll return before you know the parameters.
That was a lottle flaw I wanted to show you ;-)