Advertisement
DidiMilikina

07. 2D Rectangle Area

Sep 29th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6.     double x1, x2, y1, y2;
  7.     cin >> x1;
  8.     cin >> y1;
  9.     cin >> x2;
  10.     cin >> y2;
  11.     cout << abs(x1 - x2) * abs(y2 - y1) << endl << 2 * (abs(x1 - x2) + abs(y2 - y1)) << endl;
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement