#include<stdio.h> #include<math.h> int main(void) { double n,pi; double funpi(double n); scanf("%lf",&n); if((n<3)&&(n>8)) printf("Error!"); else if(n==0) return 0; else if((n>=3)&&(n<=8)) pi=funpi(n); scanf("%lf",&pi); return 0; } double funpi(double n) { int denominator,flag; double item,sum; flag=1; denominator=1; item=1.0; sum=0; while(fabs(item)>=pow(10,-n)){ item=flag*1.0/denominator; sum=sum+item; flag=-flag; denominator=denominator+2; } return sum*4; }