Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.43 KB | None | 0 0
  1. main =>
  2.   A = read_int(),
  3.   B = read_int(),
  4.   C = read_int(),
  5.   D_ = sqrt(B * B - 4 * A * C),
  6.   if D_ == 0.0 then
  7.     Y = -B/(2*A),
  8.     if ceiling(Y) == floor(Y) then
  9.         print(floor(Y))
  10.     else
  11.         print(Y)
  12.     end
  13.   else
  14.     X1 = (-B + D_)/(2*A),
  15.     X2 = (-B - D_)/(2*A),
  16.     L = sort([X1, X2]),
  17.     foreach (X in L)
  18.         if ceiling(X) == floor(X) then
  19.             print(floor(X))
  20.         else
  21.             print(X)
  22.         end,
  23.         print(" ")
  24.   end
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement