Advertisement
Dido09

C - Rectangle

Feb 28th, 2022
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int Ax, Ay, Bx, By, a, b, S;
  7.  
  8. printf("Coordinate of point A: ");
  9. printf("x: ");
  10. scanf("%d", &Ax);
  11. printf("y: ");
  12. scanf("%d", &Ay);
  13.  
  14. printf("Coordinate of point B: ");
  15. printf("x: ");
  16. scanf("%d", &Bx);
  17. printf("y: ");
  18. scanf("%d", &By);
  19.  
  20. a = Bx - Ax;
  21. b = By - Ay;
  22.  
  23. S = a * b;
  24.  
  25. printf("The area is: %d", S);
  26.  
  27.  
  28. return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement