#include <iostream>
using namespace std;
double e(int x, int n)
{
static double s;
if (n==0)
return s;
else
s = 1 + x*(s/n);
return e(x, n-1);
}
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