Previous Next

SQRT function
Returns the square root (as a DECIMAL value) of an expression you specify.
Syntax 
 
SQRT ( expression )
expression
A numeric expression. If the value of the expression is negative, SQRT returns the Unknown value (?).
Example 
This procedure prompts for a number and then displays the square root of that number:
 
DEFINE VARIABLE iNum AS INTEGER NO-UNDO FORMAT ">,>>9"
  LABEL "Enter a number between 1 and 9,999".
 
REPEAT WITH SIDE-LABELS CENTERED
  TITLE "SQUARE ROOT GENERATOR" COLUMN 20 1 DOWN:
  DISPLAY SKIP(2).
  SET iNum SKIP(2).
  DISPLAY "The square root of " + STRING(iNum) + " is" FORMAT "x(27)" 
    SQRT(num) FORMAT ">>>.9999".
END.

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.