findind fibonacci series till 100000

I am getting segmentation fault (SIGSEGV) while finding fibonacci series till 100000.

The question is fibonum of peer section.Here is the link

And, this is the link to my code

1.using array simply

2.using recursion

I see the problem here… the problem requires you to check whether the given number (say n) is fibonacci or not. Instead of finding each of fibonacci numbers within the given range you can simply use a mathematical formula.

Suppose n is a fibonacci number then either or both of (5nn + 4) and (5nn – 4) will b a perfect square.

refer wiki for further details

Note: just a hint in case u need it to check a perfect square -> sqrt(x)*sqrt(x)==x

p.s. its (5n^2 + 4) and (5n^2 -4)

But,what can be the reason of segmentation fault(runtime error) in this case?