Help required in "FCTRL2"

#include <stdio.h>

int main() {
int t=0, input=0, i=0, j=0;
long arr[100]={0};

scanf("%d", &t);
for (i=0;i<t;i++) {
	scanf("%d", &input);
	arr[i] =1;
	for (j=1;j<=input;j++)
		arr[i] *= j;
}

for (i=0;i<t;i++)
	printf("%ld\n", arr[i]);

return 0;
}

This piece of code gives the correct answer on code::blocks12.11. But CodeChef says ‘Wrong answer’

The reason you are getting WA is because of integer overflow because numbers are too big.100 factorial has 24 zeros! NO data type in C/C++ is sufficient to hold such large numbers. You might want to see this awesome tutorial by @kuruma

1 Like

http://www.codechef.com/viewsolution/2895261

the above code worked in my code blocks but in code chef each time its showing me either of segmentation fault(SIGSEGV) or wrong answer or time limit exceeded…can you help me??

//