Advertisement
desislava_topuzakova

2D rectangle area

Apr 12th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. x1 = float(input())
  2. y1 = float(input())
  3. x2 = float(input())
  4. y2 = float(input())
  5.  
  6. length = abs(x1 - x2)
  7. width = abs(y1 - y2)
  8.  
  9. area = length * width
  10. perimeter = 2 * length + 2 * width
  11.  
  12. print(f'{area:.2f}')
  13. print(f'{perimeter:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement