Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.51 KB | None | 0 0
  1. program QuadraticEquation;
  2. var
  3.   a, b, c, x1, x2, d : real;
  4. begin
  5.   write('a = ');
  6.   readln(a);
  7.   write('b = ');
  8.   readln(b);
  9.   write('c = ');
  10.   readln(c);
  11.  
  12.   d := sqr(b) - 4 * a * c;  
  13.  
  14.   if d < 0 then
  15.     writeln('нет корней')
  16.   else
  17.     begin
  18.        x1 := (-b + sqrt(d)) / (2 * a);
  19.        x2 := (-b - sqrt(d)) / (2 * a);
  20.        
  21.        writeln('x1 = ', x1:8:3);
  22.        writeln('x2 = ', x2:8:3);
  23.      end;
  24. end.
  25.    
  26.     write("x1: ");
  27.     writeln(x1);
  28.    
  29.     write("x2: ");
  30.     writeln(x2);
  31. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement