Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // imprimir 100 pontos da função seno no intervalo de x correspondente a dois periodos
- // antes: float x: for(x=0;x<=4*pi;x+=dx)
- // agora: int x: for(i=0;i<=100;i++)
- #include <stdio.h>
- #include <math.h>
- #define pi M_PI
- #define delta M_PI/25 // delta=4*pi/(número de pontos)
- int main(void)
- {
- int i;
- double x,x0=0.0;
- for (i=0;i<=100;i++)
- {
- x=x0+delta*i;
- printf("x=%lf radianos\t senx=%lf\n",x,sin(x));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement