Advertisement
193030

1.5 Quadratic equation solver

Sep 23rd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. program QuadraticEquationSolver;
  2. var
  3. a : real;
  4. b : real;
  5. c : real;
  6. x1 : real = 0;
  7. x2 : real = 0;
  8. begin
  9. writeln('Enter the coefficient of a: ');
  10. readln(a);
  11. writeln('Enter the coefficient of b: ');
  12. readln(b);
  13. writeln('Enter the coefficient of c: ');
  14. readln(c);
  15.  
  16. x1 := (-b + sqrt((b*b) - 4*a*c)) / (2 * a);
  17. x2 := (-b - sqrt((b*b) - 4*a*c)) / (2 * a);
  18.  
  19. writeln('The value of x1 is: ');
  20. write(x1);
  21. writeln('The value of x2 is: ');
  22. write(x2);
  23. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement