hello all
my current project is a program to approximate π (<sorry: its ugly but is pi) up to 1/99
w/ the usually taylor series representation, eg (π=4x(1-1/3+1/5...etc)
so far my code is
Code:
#include<stdio.h>
#include<stdafx.h>
#include"conio.h"
#include<math.h>
int main()
{
double n;
int i=0;
while(i<100)
{
n=(((-1)^i)/(2*i+1));
i++;
}
printf(" PI is %lf (debug %d i)", n, i);
getch();
return (0);
}
which runs but my n seems to stay 0 always... i was wondering if im approaching the problem too simply (quite simple myself) or if i am screwing up somthing (possibly ^ , i tried pow(x,x) config but that ran me into syntax.... anyways thank you for help in advance.