While7. An integer N (> 0) is given. Find the smallest positive integer K which square is greater than N: \(K^2 > N\). Do not use the function of extracting the square root.

Solution in Python 3:

import random

N = random.randrange(1,1000)
print('N = ', N)

K = 1
while K*K <= N:
K += 1

print("K = {0}, K^2 = {1}, (K-1)^2 = {2}".format(K,K**2,(K-1)**2))