All pastes #273783 Raw Edit

vsingh16

public cpp v1 · immutable
·published 2006-12-10 03:51 UTC
rendered paste body
#include <fstream>#include <iostream>using namespace std;int main(){    ofstream a_file ( "pi.txt" );    int digits;    float summation = 0.0;    float pi_approx = 0.0;        cout<<"Number of digits of pi: "<<endl;    cin>>digits;        for (int count=0; count <= digits; count++) {        summation = summation + (((-1^count)*((-32/(4*count)+1)-(1/(4*count)+3)+(256/(10*count)+1)-(64/(10*count)+3)-(4/(10*count)+5)-(4/(10*count)+7)+(1/(10*count)+9)))/(1024^count));    }        pi_approx = summation * (1/64);        a_file<<pi_approx;    cin.get();        system("PAUSE");    return 0;}