#include <stdio.h>
#include <math.h>
double factorial(int n) {
double res = 1.0;
for (int i = 2; i <= n; i++) res *= i;
return res;
}
double taylor_tan(double x, int n) {
double rad = x * M_PI / 180.0;
double res = 0.0;
for (int i = 1; i <= n; i += 2) {
double term = pow(rad, i) / factorial(i) * (i % 4 == 1 ? 1 : -1);
res += term;
if (fabs(term) < 1e-10) break;
}
return res;
}
int main() {
double x;
int n = 100;
printf("Введите значение угла в градусах: ");
scanf("%lf", &x);
printf("tg(%lf) = %lf\n", x, taylor_tan(x, n));
return 0;
}