#include <iostream> using namespace std; double e (int x, int n) { static double p=1, f=1; double r=0; if (n==0) return 1; else r = e(x,n-1); p=p*x; f=f*n; return r+(p/f); } int main() { double sum= e(1,10); cout << sum; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter