Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double factor(int a)
  5. {
  6. if (a==0 || a == 1) return (1);
  7. else return (a*factor(a-1));
  8. }
  9.  
  10. double power(double x)
  11. {
  12. double a = 1;
  13. for (int i=0; i<=11; i++)
  14. {
  15. a*=x;
  16. return a;
  17. }
  18.  
  19. }
  20.  
  21. double taylor(double x)
  22. {
  23. double deg = 0;
  24. int n;
  25. for (n = 0; n<11; n++)
  26. {
  27. double p = pow(-1, n);
  28. double px = pow(x, 2*n+1);
  29. long payda = factor(2*n+1);
  30. deg += p*px/payda;
  31.  
  32. }
  33. return deg;
  34. }
  35. int main()
  36. {
  37. double aci;
  38. printf ("Aci gir orospucocugu:");
  39. scanf ("%lf", &aci);
  40. printf ("%.2f'nin Taylor serisine gore sinus degeri: %.8lf\n", aci, taylor(aci*3.1415/180));
  41. printf ("%.2f'nin bilgisayar beye gore sinus degeri (emek hirsizi oc): %.8lf", aci, sin(aci*3.1415/180));
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement