Created
December 8, 2017 16:37
-
-
Save anonymous/d4ae335299d03b8b964c3683976ecce8 to your computer and use it in GitHub Desktop.
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
/** 引数の平方根を求める関数. */ | |
public static BigInteger sqrt(BigInteger terget) { | |
// 変数初期化 | |
BigInteger num = BigInteger.ONE; | |
// ループ条件:対象 < 変数^2 | |
while (terget.compareTo(num.multiply(num)) > 0) { | |
// num++ | |
num = num.add(BigInteger.ONE); | |
} | |
return num; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment