Advertisement
Guest User

Решение квадратных уравнениий

a guest
Sep 29th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.58 KB | None | 0 0
  1. program num1;
  2. var a,b,c,d,x1,x2,x,w:real;
  3. begin
  4.  write ('a=');
  5.  read (a);
  6.  write('b=');
  7.  read (b);
  8.  write ('c=');
  9.  read (c);
  10.  d:=sqr(b)-(4*a*c);
  11.  write ('d=',d:4:2);
  12.  w:=sqrt(d);
  13.  writeln (' Корень из дискриминанта ',w:4:2);
  14.  if d>0
  15.    then
  16.     begin
  17.      x1:=((-b)+w)/(2*a);
  18.      x2:=((-b)-w)/(2*a);
  19.      writeln ('x1=',x1:4:2);
  20.      writeln ('x2=',x2:4:2);
  21.     end
  22.    else
  23.     if d=0
  24.      then
  25.       begin
  26.        x:=(-b)/(2*a);
  27.        writeln ('x=',x:4:2);
  28.       end
  29.      else if d<0
  30.       then
  31.        writeln (' нет корней');
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement