daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void tut(double xo,double yo,double r,double x1,double y1,double x2,double y2);
  5.  
  6. int main (void)
  7. {
  8.     double xo,yo,r,x1,y1,x2,y2;
  9.     scanf("%lf",&xo);
  10.     scanf("%lf",&yo);
  11.     scanf("%lf",&r);
  12.     scanf("%lf",&x1);
  13.     scanf("%lf",&y1);
  14.     scanf("%lf",&x2);
  15.     scanf("%lf",&y2);
  16.     tut(xo,yo,r,x1,y1,x2,y2);
  17.     return 0;
  18. }
  19.  
  20. void tut(double xo,double yo,double r,double x1,double y1,double x2,double y2)
  21. {
  22.     double pi,a1,b1,a2,b2,cos,fi,fi2,otvet;
  23.     pi=3,14159;
  24.     a1=abs(y1-yo);
  25.     b1=abs(x1-xo);
  26.     a2=abs(y2-yo);
  27.     b2=abs(x2-xo);
  28.     cos=(a1*a2+b1*b2)/sqrt(a1*a1+b1*b1)*sqrt(a2*a2+b2*b2);
  29.     fi=acos(cos);
  30.     fi2=(fi*180)/pi;
  31.     otvet=(r*r*fi2)/2;
  32.     printf("%lf",otvet);
  33.     return;
  34. }
RAW Paste Data
Top