Write a function named isSquare that returns 1 if its integer argument is a square of some integer, otherwise it returns 0. Your function must not use any function or method (e.g. sqrt) that comes with a runtime library or class library!
The signature of the function is
int isSquare(int n)
Examples:
if n is return reason
4 1 because 4 = 2*2
25 1 because 25 = 5*5/td>
-4 0 because there is no integer that when squared equals -4. (note, -2 squared is 4)
8 0 because the square root of 8 is not an integer.
0 1 because 0 = 0*0
Software/Hardware used:
ASKED:
October 6, 2008 7:27 AM
UPDATED:
October 6, 2008 6:18 PM