Advertisement
luizaspan

Sin(x) 0 a 4*pi rad

Apr 30th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. // imprimir 100 pontos da função seno no intervalo de x correspondente a dois periodos
  2.  
  3. // antes: float x: for(x=0;x<=4*pi;x+=dx)
  4. // agora: int x: for(i=0;i<=100;i++)
  5.  
  6. #include <stdio.h>
  7. #include <math.h>
  8. #define pi M_PI
  9.  
  10. #define delta M_PI/25  // delta=4*pi/(número de pontos)
  11.  
  12. int main(void)
  13. {
  14.  
  15.   int i;
  16.   double x,x0=0.0;
  17.  
  18.   for (i=0;i<=100;i++)
  19.     {
  20.       x=x0+delta*i;
  21.       printf("x=%lf radianos\t senx=%lf\n",x,sin(x));
  22.     }
  23.  
  24.   return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement