Ladies_Man

Площадь треугольника

Dec 17th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.34 KB | None | 0 0
  1. (define (area-of-triangle x1 y1 x2 y2 x3 y3)
  2.   (let* (
  3.          (a (sqrt(+ (* (- x2 x1) (- x2 x1)) (* (- y2 y1) (- y2 y1)))))
  4.          (b (sqrt(+ (* (- x3 x2) (- x3 x2)) (* (- y3 y2) (- y3 y2)))))
  5.          (c (sqrt(+ (* (- x3 x1) (- x3 x1)) (* (- y3 y1) (- y3 y1)))))
  6.          (p (/ (+ a b c) 2)))
  7.          (sqrt (* p (- p a) (- p b) (- p c)))))
Advertisement
Add Comment
Please, Sign In to add comment