Perfect Square Checker
Check whether an integer is a perfect square. The result is 1 for yes and 0 for no; zero is accepted and negative integers return no.
Formula
n is a perfect square if n=k² for an integer k.
Perfect square? 1=yes, 0=no ≈ 1-min(1,abs((16)-(4)^2))
How to use
- Enter an integer between −1,000,000,000 and 1,000,000,000.
- Keep its sign.
- Read 1 for a perfect square or 0 otherwise.
Examples
- 16 and 0 return 1; 15 and −4 return 0.
Frequently asked questions
Can a negative integer be a perfect square?
No. An integer squared is always nonnegative.
Is zero a perfect square?
Yes, because 0²=0.
Are decimals accepted?
No. This check concerns squares of integers.
Sources
Updated: