Advertisement
ahamed210

Geometry

Mar 3rd, 2021
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define pi 3.14
  4. int main()
  5. {
  6.     double x,y;
  7.     scanf("%lf %lf", &x, &y);
  8.     double r = y/4.0;
  9.     double cir_area = pi*r*r;
  10.     double a = x - r;
  11.     double b = r*2.0;
  12.     double c = (a*a) + (b*b);
  13.     double tri_area = (y/4.0) * sqrt((4.0*c) - (y*y));
  14.     if((cir_area+tri_area) >= (x*y)) printf("-1\n");
  15.     else printf("%lf\n", (x*y)- (cir_area+tri_area));
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement