Advertisement
Guest User

OLLLLLLLLLLLLLLLLLLLLLLLLL

a guest
Nov 21st, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. unsigned long fak(unsigned long f)
  5. {
  6. if ( f == 0 )
  7. return 1;
  8. return(f * fak(f - 1));
  9. }
  10.  
  11.  
  12.  
  13. int main(){
  14.  
  15. int n =4;
  16. int x =4;
  17. double sum = 0.0;
  18. for(int i = 0; i<=n ; i++){
  19. //sum += pow(-1,i)*(pow(x,(2*i+1))/fak(2*i+1));
  20. sum += pow(-1.0,i)*((pow(x,((2*i)+1))/fak(((2*i)+1))));
  21. }
  22. printf("Sin(%lf) = %lf",x,sum);
  23.  
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement