print('平方根(ただし不正確)')
A=0
k=0
x=2
for I in range(10):
    for i in range(10):
        k += (0.1) ** I
        if k**2 == x:
            break
        if k**2 > x:
            k -= (0.1) ** I
            break
ERR=x-(k**2)
print(k)
print(f'誤差:{ERR}')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: