Here is the Quesion ::

I want to write a program that estimates the value of the mathematical constant e by using the formula:

`e = 1 + 1/1! + 2/2! + 3/3! + 4/4! + ………+ n/n!`

Here is my Answer:

```
#include <iostream.h>
int main ()
{
double x , f=1 , n ,i ,r ,s=0;
cout<<"Enter a number";
cin>>n;
x=1;
while (x<=n)
{
f=f*x;
i=0 ;
while (i<=x)
{
r=n/f;
i++;
}
s=s+r;
x++;
}
cout<<"e="<<s;
return 0;
}
```

I'm not sure if its correct ?? can anyone help me ? and i want to ask why do i get the same value when i enter a number >5??