code

code

Den

1. 1, 2, 3 (корней нет

2. 2, -5, 2 (2, 1/2

3. 5, 5, 5 (корней нет 

4. 1, 3, 0 (-3 0

5. 1, -9, 8 (8, 1

6. 1, -2, 1 (корень 1

7. 8, 13, 6 (корней нет

8. 3, 6, 3 (корень -1

9. 5, -10, 5 (корень 1

0. 1, 6, 5 (-2 -11/4 

insert into equation

values(1, 1, 2, 3);

insert into equation

values(2, 2, -5, 2);

insert into equation

values(3, 5, 5, 5);

insert into equation

values(4, 1, 3, 0);

insert into equation

values(5, 1, -9, 8);

insert into equation

values(6, 1, -2, 1);

insert into equation

values(7, 8, 13, 6);

insert into equation

values(8, 3, 6, 3);

insert into equation

values(9, 5, -10, 5);

insert into equation

values(10, 1, 6, 5);

commit;

create or replace package SoQE is

   procedure solution (x1 number, x2 number);

   procedure solution (x number);

   procedure solution;

end SoQE;

/

create or replace package BODY SoQE is

   procedure solution(x1 number, x2 number) is

       begin

           insert into rudes

           values (number_of_equation, x1, x2);

       end solution;

   procedure solution(x number) is

       begin

           insert into rudes

           values (number_of_equation, x1);

       end solution;

   procedure solution is

       begin

           insert into rudes

           values (number_of_equation, null, null);

       end solution;       

end SoQE;

/

create or replace procedure solve(number_of_equation integer,coeff_a int, coeff_b int, coeff_c int) is

   De number;

   x1 number;

   x2 number;

begin

       De := coeff_b*coeff_b - 4*coeff_a*coeff_c;

       if De < 0

           then SOQE.SOLUTION(number_of_equation);

           else if De = 0

                   then SOQE.SOLUTION(number_of_equation, -coeff_b/(2*coeff_a));

                   else

                   begin

                       x1 := (-coeff_b+sqrt(De))/2*coeff_a;

                       x2 := (-coeff_b-sqrt(De))/2*coeff_a;

                       SOQE.SOLUTION(number_of_equation, x1, x2);

                   end;

               end if;

       end if;

end solve;

Report Page