Created
February 18, 2018 18:01
-
-
Save arrbxr/5ddab552cdcd3123f61e1edac4c8b2e8 to your computer and use it in GitHub Desktop.
Find the next perfect square! created by arrbxr - https://repl.it/@arrbxr/Find-the-next-perfect-square
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findNextSquare(sq){ | |
for(var i = 1; i<=sq; i++){ | |
if(i * i == sq){ | |
i++; | |
return i*i; | |
} | |
} | |
return -1; | |
} | |
findNextSquare(319225); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment