Here are my codes:
But it does not work at all somewhere after n=12, because of ‘overflow’. I tried ‘long long’ but that did not work either.
What should I do to make this work? I’d appreciate any help and advice.
Did you tried to use double? It depends on how far you want to go, if you keep overflowing you can search for a library that handle big numbers.
Right, it works! And I tried using “long long” again and made it. But what’s weird is that there is a small difference between the results output by lld and lf, like, the former is more accurate than the latter. Can I ask why?
Really? Long should be more accurate than double, but less capable of storing big numbers. Also, you can use long double if you want.
It’s best if I link you for a proper answer.
Yeah, this helps me. Thank you!