On 14/08/11 05:56, Rahul wrote:
# To change this template, choose Tools | Templates
# and open the template in the editor.

puts "Hello World"
def squareroot(a)
   u=a
   l=0
   while (l<=u)
     m = l + (u-1)/2

       puts "u = #{u}, l = #{l}, m = #{m}"

     if (m**2) < a

[snip rest of code]

Try adding in that extra line of code and I think you might understand your logic error.

HTH
John

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to