Function Prototype of tan()
double tan(double x)
The tan() function returns tangent of a number (angle in radians).
[Mathematics] tanx = tan(x) [In C Programming]
It is defined in math.h header file.
Example: C tan() function
#include <stdio.h>
#include <math.h>
int main()
{
double x;
double result;
x = 2.3;
result = tan(x);
printf("tan(%.2lf) = %.2lf\n", x, result);
x = -2.3;
result = tan(x);
printf("tan(%.2lf) = %.2lf\n", x, result);
x = 0;
result = tan(x);
printf("tan(%.2lf) = %.2lf\n", x, result);
return 0;
}
Output
tan(2.30) = -1.12 tan(-2.30) = 1.12 tan(0.00) = 0.00