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.

n = int(input("Input a natural number: ")) def squareroot(n): sqrt=1 while sqrt*sqrt<=n: sqrt+=1 return sqrt squareroot(n)

Questions about programming?Chat with your personal AI assistant