#include "stdafx.h"
#include
#include
# define M_PIl 3.141592653589793238462643383279502884L
using namespace std;
long double fact(int N)
{
if (N < 0)
return 0;
if (N == 0)
return 1;
else
return N * fact(N - 1);
}
int main()
{
cout << " n = ";</p>
int n; cin >> n;
cout << " h = ";</p>
float h; cin >> h;
float x = 0; int i = 1; float S = 1;
if (n == 0)
{
cout << "S(" << x << ") = " << 0 << endl;</p>
}
else
{
while ((x <= 1) && (i <= n))</p>
{
S += (cos(i*(M_PIl / 4)) / fact(i))*pow(x, i);
cout << "S(" << x << ") = " << S << endl;</p>
x = x + h;
i = i + 1;
}
}
return 0;
}