Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Square Root of a number

Former Member
0 Kudos
6,639

Dear all

How can i get the square root of a number.for examle 4 from the number 16,as

16 = 4*4.

Best Regards

Bunty

1 ACCEPTED SOLUTION

Pawan_Kesari
Active Contributor
1,496

DATA : in  TYPE f VALUE 16 ,
       out TYPE f  .

CALL METHOD cl_foev_builtins=>square_root
  EXPORTING
    im_number = in
  IMPORTING
    ex_result = out.

WRITE out .
2 REPLIES 2

Pawan_Kesari
Active Contributor
1,497

DATA : in  TYPE f VALUE 16 ,
       out TYPE f  .

CALL METHOD cl_foev_builtins=>square_root
  EXPORTING
    im_number = in
  IMPORTING
    ex_result = out.

WRITE out .

varma_narayana
Active Contributor
1,496

Hii

To get the Square root: use the arithmetic Function SQRT( ).

Sample code: try...

DATA: V1 TYPE I VALUE 100.

DATA : V_ROOT TYPE I.

V_ROOT = SQRT( V1 ).

WRITE:/ 'square root = ', v_root.

<b>reward if Helpful.</b>