+ 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.

27th Feb 2018, 2:36 AM
Amrit Prasad
Amrit Prasad - avatar
2 Answers
+ 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.
27th Feb 2018, 2:22 PM
Amrit Prasad
Amrit Prasad - avatar
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 ;-)
27th Feb 2018, 6:22 AM
D B
D B - avatar