# Life of Decimals

Given any circle, if you divide the circumference of that circle with its diameter, you would always…

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

1 Like

What’s wrong here?
@touhidur @hjr265

``````#include <stdio.h>
#include <math.h>

int main() {
char str ={'1', '4', '1', '5', '9', '2', '6', '5', '3', '5', '9', '0'};
int a, i, b;
scanf("%d", &a);
for(i=0; i<a; i++)
{
scanf("%d", &b);
printf("%c\n", str[b-1]);
}
return 0;
}
``````

The first 15 digit of pi 14159265358979

1 Like

@mahfuzAhmed Read the problem again. Why 15 digits?

I didn’t say you need 15 digits. I gave those to check your digits in the `char str` array.

Thanks my bro. Solved it.

27 Test Cases !!!   I don’t think that number of test-cases does matter.

The c code given formats the number so it prints 0141592653590 instead of correct 0141592653589. Change it.

Can anyone tell me what is wrong?

I’m attaching the code here:

Code
``````def multi_input(num):
l = []
for i in range(num):
u = int(input())
l.append(u)

return l

pi2 = list(str(14159265358979))

a = int(input())
n = multi_input(a)

for i in n:
ii = i - 1
print(int(pi2[ii]))
``````

@abdullahibn200 You have to print one output at a time. For example, after getting first input print the result 1. Then take the second input and print the result 4. New solvers often get into this situation.

1 Like

Thanks a lot for helping, @imamanik05.

@abdullahibn200 You can also test your submission as samples by clicking Test before submitting.