Why do we store only 52 digits in character array ,even if the approximation is infinite…???

Why do you need to store the 52 digits when we can print each digit after performing division operation…?

Which 52 digits are you talking about??

here is my logic to solve this problem, you don’t need to make an array to store values, you can just calculate it using normal division, like we do it on paper during school days…

while(test--) { scanf("%d", &k); val = 103993/33102; mod = 103993%33102; if (k==0) { printf("%d\n",val); continue; } printf("%d.",val); while(k--) { val = (mod*10)/33102; mod = (mod*10)%33102; printf("%d",val); }

well after some characters there are 52 characters which are repeating in digits of pi. thats why we store 52 characters to save time calculations…

it is similar to 1/3 … like 0.333333 , 3 is repeating after one digit

fact is same for pi

3.14159265301190260407226**149477372968400700863996133164159265301190260407226**1494

77372968400700863996133164159265301190260407226**14947737296840070086399613316415926
5301190260407226**

415926530119026040722614947737296840070086399613316

these are the digits which others have used in their solution…

is it a recurring fraction…???

ok got it…thanks…!!!

yes it is