Cuadratica en SQL






create or replace procedure p_cuadratica(a number, b number, c number)
is
r1 number(7,2);
r2 number(7,2);
res number(7,2);
pot number(7,2);
rad number(7,2);
begin
   pot:=power(b,2);
   res:=4*a*c;
   rad:=pos-res;
   DBMS_OUTPUT.PUT_LINE('POTENCIA: '||POST);
   DBMS_OUTPUT.PUT_LINE('RADICAL: '||RAD);
   DBMS_OUTPUT.PUT_LINE('RESTA: '||REST);
 
   IF (rad > 0)then
      r1:=-(b-sqrt(pot-res))/2*a;
      r2:=-(b-sqrt(pot-res))/2*a;
      DBMS_OUTPUT.PUT_LINE('RAIZ 1: '||R1);
      DBMS_OUTPUT.PUT_LINE('RAIZ 2: '||R2);
   ELSE
   DBMS_OUTPUT.PUT_LINE('RAIZ NO VAILDA');
   END IF;
   END p_cuadratica;
   

Share this

Related Posts

Previous
Next Post »