ユーザー入力「n」があり、平方根を見つけています。私が知っているのはmath.sqrt(n)ですが、プログラムが2未満になるまで平方根を見つけ続けるようにする必要があります。カウンター。私はパイソンを使用しています。
ここのところ:
import math
root = 0
n = input('Enter a number greater than 2 for its root: ')
square_root = math.sqrt(n)
print 'The square root of', n, 'is', square_root
keep_going = 'y'
while keep_going == 'y':
while math.sqrt(n) > 2:
root = root + 1