#include <iostream>
#include <cmath>
using namespace std;


const int PRECISION = 100;


int main() {

	float x;
	cout << "Input x: ";
	cin >> x;

	float cosX = 1;
	float next = 1;
	float step = 2;
	
	while(step < PRECISION) {
		next = -next * x * x / step / (step - 1);
		cosX += next;
		step += 2;
	}

	cout << "cos(" << x << ") = " << cosX << " ~ " << cos(x) << endl;
	
	return 0;
}
