#include "stdafx.h"
#include
#include
#include
using namespace std;
void main()
{
const float eps = 0.001f;
float x, xn , y, y0;
unsigned int n = 1, nf = 1;
cout "Input n, x:" endl;
cin >> n >> x;
y = 1;
do
{
int nf = 1;
for (int m = 1; m n; m++)
nf *= m;
y0= y ;
y=(xn)/2(nf) ;
n++;
}
while (abs(y - y0) > eps);
y0 = cos (x);
cout "Result of iterative calculation: " setw(9) \
setprecision(5) y endl;
cout "Result of direct calculation: " setw(9) \
setprecision(5) y0 endl;
cout "Number of iterations: " setw(5) n endl;
}