Guest User

Untitled

a guest
Dec 10th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1.  
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int main()
  7. {
  8.     float pow=2, nr, dr=1, x1, sum=1, x;
  9.     int i = 1,n,s = -1;
  10.     printf("Introducir angulo (rad): \n");
  11.     scanf("%f", &x);
  12.     printf("Introducir numero entero para determinar la precision: \n");
  13.     scanf("%d",&n);
  14.    
  15.     nr = x*x;
  16.    
  17.     while(i<=n)
  18.     {
  19.         dr = dr * pow * (pow - 1.0);
  20.         sum = sum + (nr / (dr * s));
  21.         s = s * (-1);
  22.         pow = pow + 2.0;
  23.         nr = nr * x * x;
  24.         i++;
  25.     }
  26.    
  27.     printf("THE SUM OF THE COS SERIES IS: %f", sum);
  28.  
  29.     return (EXIT_SUCCESS);
  30. }
Add Comment
Please, Sign In to add comment