Advertisement
yoyo106

Untitled

Oct 16th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define PI 3.14159265359
  4. void main()
  5. {
  6.     int i, n;
  7.     float x, sum, t;
  8.  
  9.     printf(" Enter the value for x : ");
  10.     scanf("%f",&x);
  11.  
  12.     printf(" Enter the value for n : ");
  13.     scanf("%d",&n);
  14.  
  15.     x=x*PI/180;
  16.     t=x;
  17.     sum=x;
  18.  
  19.     for(i=1;i<=n;i++)
  20.     {
  21.         t=(t*(-1)*x*x)/(2*i*(2*i+1));
  22.         sum=sum+t;
  23.     }
  24.  
  25.     printf(" The value of Sin(%f) = %.3f",x,sum);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement