//What value will this print out, rounded to the nearest hundredths?
void main ()
{
int x=1;
float kittens=0;
while (x<600000000000)
{
if (x%2==1)
{
kittens=kittens+(1.0/(2*x-1));
}
else
{
kittens=kittens-(1.0/(2*x-1));
}
x++;
}
kittens=4*kittens;
printf("%f\n",kittens);
}
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
x is increasing by 1 each time, correspondingly values of kittens are operated as=1-1/3+1/5-1/7+--------------------=tan(inverse)(1)=pi/4 now kittens=4*pi/4; therefore kittens=pi=3.143--- thanks