@Nikhil: Your example shows a strange use of the phrase "nearest
square". It would seem that the nearest square to 27 would be 25, not
sqrt(25). But anyway
If n = 0 return 0
Else
recursively find k = the nearest square to n/4
return 2*k-1, 2*k, or 2*k+1, whichever one squared is closer to
n.
Dave
On Aug 7, 9:41 am, Nikhil Veliath <[email protected]> wrote:
> write a recursive code to print the nearest square of a number....
>
> eg if no is 27
>
> the nearest square is 5....
>
> it should also take care of large nos...
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.