PDA

View Full Version : natural number


teng125
Aug13-06, 04:48 PM
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

0rthodontist
Aug13-06, 05:03 PM
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

teng125
Aug13-06, 05:58 PM
what can i write for sqrt(i) in the pseudo code for pascal??

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