Results 1 to 4 of 4

Thread: Making a program to find the square root of any number

  1. #1

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Talking

    Does anybody know how to code a program to find the square root of any number I put into a textbox.
    I have text1 as the input box
    text2 as the answer box
    and command1 as the button to find the square root

    I also need to know if anybody can make a program to solve for a variable using the same items for like input and that and i want it to solve stuff like
    X*5=2x+20-2x
    stuff like that

    i would like the coding for both but either one is fine if anybody knows how

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Here's the first part.
    Code:
    Function CalculateSquareRoot(NumberArg As Double) As Double
       If NumberArg < 0 Then   ' Evaluate argument.
          Exit Function   ' Exit to calling procedure.   
       Else
          CalculateSquareRoot = Sqr(NumberArg)   ' Return square root.   
       End If
    End Function

  3. #3
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    First question: use either one of the two lines:
    MARTY WAS SECONDS FASTER

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    X^0.5 works fine too.

    Third root:

    X^(1/3)

    For the second part, i'm just working on a ActiveX Dll that does that.

    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width