thien

BÀI 20

Mar 2nd, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. BÀI 20:
  2.  
  3. #include <stdio.h>
  4. #include <conio.h>
  5. #include <math.h>
  6. main ()
  7. {
  8. int i=1; float c,sinx,S,x;
  9. printf ("Nhap c:"); scanf ("%f",&c);
  10. printf ("\nNhap x:"); scanf ("%f",&x);
  11. S=x;sinx=x;
  12. do
  13. {
  14. S*=S*x*x/((2*i)*(2*i+1));
  15. if (i%2==0) sinx+=S;
  16. else sinx-=S;
  17. i++;
  18. }
  19. while (fabs(S)>c);
  20. printf ("sinx=%f",sinx);
  21. getch();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment