Finding the Greatest Integer Square Root of an Integer

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
teng125
Messages
416
Reaction score
0
Consider the square root operation. Suppose an integer numbers i > 0 as input variable.
Design an algorithm which calculates the greatest natural number less than or equal to
the square root of the input variable i.


can smby pls explain to me what does this ques mean??if possible explain using some example

thanx
 
Physics news on Phys.org
A natural number just means a positive integer, like 1, 2, 3, 4, 5.

Here are some examples of what your algorithm should do:
sqrt(1) = 1
sqrt(2) = 1
sqrt(3) = 1
sqrt(4) = 2
sqrt(5) = 2
sqrt(57) = 7
sqrt(170) = 13
 
what can i write for sqrt(i) in the pseudo code for pascal??

is it just sqrt(i) or any others??