I need a script that does: "(4/1)-(4/3)+(4/5)-(4/7)+(4/9)-(4/11)+(4/13)-(4/15)..." and thereby calculates pi, and I'm having a bit of a problem.
I've got this so far, and I'm coming nowhere:
Please help me! I'm trying to make it like this:
"
1. 4
2. 2
3. 3.333
4. 2.333
etc..
Thanks in advance,
"DLA"
I've got this so far, and I'm coming nowhere:
PHP Code:
<?php
$number=1;
$var_1=4/$number;
$n1=$number+1;
$n2=$n1/2
if(number/2<1000)
{
echo $n2 . ". " . $var_1;
$number+2;
}
?>
"
1. 4
2. 2
3. 3.333
4. 2.333
etc..
Thanks in advance,
"DLA"
Comment