One question per day 65

Question 65: Find the approximate value of PI.Insert picture description here

Insert picture description here

#include"stdio.h"
#include"math.h"
void main()
{ double pi,p=0,i=1,x=1;//x denominator, i single item value int f=1; //represent Sign bit while(fabs(i)>=1e-6) { p+=i; x+=2; f=-f; i=f/x; } pi=p*4; printf(“pi=%f\n ”,Pi); }











Guess you like

Origin blog.csdn.net/drake_gagaga/article/details/114004321
Recommended