+ 1

How to output the number e?

23rd Dec 2017, 5:37 AM
Alisher
2 Respuestas
+ 5
you can approximate it. these are two way to do this: 1) e=1+1/fact(1)+ 1/fact(2)+ ... +1/fact(n) 2) e=(1+1/n)^n and if n become bigger your approximation become more accurate. and this is it's code. https://code.sololearn.com/cEOMe1kVWq2h/?ref=app
23rd Dec 2017, 6:59 AM
M3hran
M3hran - avatar
0
Google it and make it a constexpr. You can put as many decimal places as you want, but it doesn't get more accurate after approximately 20 of them.
23rd Dec 2017, 9:38 AM
Timon Paßlick