#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int sum=0;
float pi=0,a=1.0,c=1.0;
int b=1;
do
{
pi=pi+c;
sum=sum+1;
a=a+2.0;
b=-b;
c=b/a;
}while(fabs(c)>1e-4);
pi=4.0f*pi;
cout<<"pi="<<pi<<endl;
cout<<"sum="<<sum<<endl;
return 0;
}