+ 2
Fibonacci sequence help!!
When I try find the 94. fibonacci terms, result is not logiccally, like -123458796487. What should I do in C/C++ when I want find sum of big numbers?
15 Antworten
+ 20
Try using Hatsy Rei's method
https://code.sololearn.com/cqtn357OfStn/?ref=app
+ 15
https://code.sololearn.com/cSC16oNf6laZ/?ref=app
+ 6
Ali B., you need an even more complex algorithm and a very powerful hardware system such as a supercomputer or something like that!
+ 4
Then try something like this:
AliRà«Żza's code:
https://code.sololearn.com/caP8649IZ2fH/?ref=app
+ 2
use long int
+ 1
actually firstly I did long long but gave same error then I tried long int again same :)
+ 1
long long int
not just long long
+ 1
Ali B. your code is working perfectly no errors
+ 1
but I need sum of terms till the 4billion
0
I did but doesnt work
https://code.sololearn.com/cV91JXi8XNyy/?ref=app
0
try long long
0
yes I wrote like this you can check the code
https://code.sololearn.com/cV91JXi8XNyy/?ref=app
0
Sreejith no there is error 94th term
0
num = int(input())
def f(n):
#complete the recursive function
u=0
v=1
print(0)
print(1)
for i in range(2,n):
c=u+v
u=v
v=c
print(v)
f(num)