Microsoft Small Basic

Program Listing: CML298
' Calculate Napier's constant (the base of the natural logarithm)
' Version A
' Copyright © 2015 Nonki Takahashi. The MIT License.
' Last update 2015-06-19
' e = Σ(n=0..∞) 1/n!
f = 1
e = 0
n = 0
While "True"
e = e + 1 / f
TextWindow.Write(n + "!=" + f)
TextWindow.WriteLine(" e=" + e)
n = n + 1
f = f * n
EndWhile