Pages

Monday, 17 October 2016

Cube and Cuberoot of a Number

Write a PLSQL block to calculate Cube and Cuberoot of a number.



Program:



declare
a int:=8;
cube int;
root int;
begin
cube:= a*a*a;
select power(8,1/3) into a from dual;dbms_output.put_line('The Cube of the number is'||cube);
dbms_output.put_line('The cuberoot of number is' || a);
end;
/


Output:
The Cube of the number is 512

The cuberoot of number is 2

1 comment:

  1. declare
    a int:=8;
    cube int;
    root int;
    begin
    cube:= a*a*a;
    select power(8,1/3) into a from dual;dbms_output.put_line('The Cube of the number is'||cube);
    dbms_output.put_line('The cuberoot of number is' || a);
    end;
    /

    ReplyDelete