fork download
  1. #include <stdio.h>
  2. main() //長方形面積&周長
  3. {
  4. int a,b,c,d,x,y,area,peripheral;
  5. scanf("%d%d%d%d", &a,&b,&c, &d);
  6. x=(a>c)? a-c:c-a;
  7. y=(b>d)? b-d:d-b;
  8. area=x*y;
  9. peripheral=2*(x+y);
  10. printf("%d\n%d",area,peripheral);
  11. }
Success #stdin #stdout 0s 5280KB
stdin
-1 5 6 -3
stdout
56
30