Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- unsigned long fak(unsigned long f)
- {
- if ( f == 0 )
- return 1;
- return(f * fak(f - 1));
- }
- int main(){
- int n =4;
- int x =4;
- double sum = 0.0;
- for(int i = 0; i<=n ; i++){
- //sum += pow(-1,i)*(pow(x,(2*i+1))/fak(2*i+1));
- sum += pow(-1.0,i)*((pow(x,((2*i)+1))/fak(((2*i)+1))));
- }
- printf("Sin(%lf) = %lf",x,sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement