rendered paste body#include <stdio.h>
#include <cstdlib>
#include <math.h>
int main( )
{
float mypi = 1;
bool mode = false;
printf( "| WOOT! BRETTS PI CALULATOR! |\n\n" );
for ( unsigned i = 0; i < 100; i++ )
{
if( mode ) {
mypi += ( 1.0 / ( ( 3 + ( 2 * i ) ) * ( pow( (double)3, (int)( i + 1 ) ) ) ) );
}else{
mypi -= ( 1.0 / ( ( 3 + ( 2 * i ) ) * ( pow( (double)3, (int)( i + 1 ) ) ) ) );
}
mode = !mode;
}
mypi = sqrt( (double)12 ) * mypi;
printf( "PI: %f\n", mypi );
system( "PAUSE" );
return 1;
}