Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define pi M_PI
- int main(void)
- {
- int k;
- double soma,e;
- for(k=0;k<9;k++)
- {
- soma+=2*pow(-1.0,k)*pow(3.0,1/2-k)/(2.0*k+1);
- printf("%f \n",soma);
- }
- e=fabs((pi-soma)/pi);
- printf("\nValor real: %lf \n",pi);
- printf("Valor calculado pela série: %lf \n",soma);
- printf("Erro relativo: %lf \n",e);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement