generate functionThu, 02 Mar 2023

A natural number n is entered. Print the first natural number found (that is, iterate over numbers starting from 1) whose square is greater than n. Implement the program using a while loop.

def natural_number(n): i = 1 while (i+1)**2 < n: i += 1 return i natural_number(4)

Questions about programming?Chat with your personal AI assistant