Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- double factor(int a)
- {
- if (a==0 || a == 1) return (1);
- else return (a*factor(a-1));
- }
- double power(double x)
- {
- double a = 1;
- for (int i=0; i<=11; i++)
- {
- a*=x;
- return a;
- }
- }
- double taylor(double x)
- {
- double deg = 0;
- int n;
- for (n = 0; n<11; n++)
- {
- double p = pow(-1, n);
- double px = pow(x, 2*n+1);
- long payda = factor(2*n+1);
- deg += p*px/payda;
- }
- return deg;
- }
- int main()
- {
- double aci;
- printf ("Aci gir orospucocugu:");
- scanf ("%lf", &aci);
- printf ("%.2f'nin Taylor serisine gore sinus degeri: %.8lf\n", aci, taylor(aci*3.1415/180));
- printf ("%.2f'nin bilgisayar beye gore sinus degeri (emek hirsizi oc): %.8lf", aci, sin(aci*3.1415/180));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement