# tan in c

## What is tan in c programming?

tan in c is a mathematical function which is used to find tangent value of a given number.

This function is defined in math.h header file.

### Prototype

``````#include<math.h>
double tan(double y);``````

### Parameters

tan function takes floating point value as angle in radians.

### Return value

This function returns tangent of a given number.

## Example program for tan in c

``````#include <stdio.h>
#include <math.h>
#define PI 3.14
int main()
{
double x, res, val1;
x=15.0;
val1=PI/180;
res=tan(x*val1);
printf("The tan of %lf is %lf degrees", x, res);
return 0;
}``````

``gcc file_name.c -lm``

### Code explanantion

The variable val1 is defined in terms of degrees and passed the tan function along with the input value. The result is printed onto the console.

tan() Man page

## Difference between tan and tanh in c

tan in c is a mathematical function that is used to find the tangent of a given number. tanh in c is used to find the hyperbolic tangent of a given number.

Prototypes are as follows

``````double tan(double y);

double tanh(double y);``````

## Difference between tan and sin in c

tan in c is a mathematical function that is used to find the tangent of a given number. sin in c is a mathematical function that is used to find the sine of a given number.

Prototypes are as follows

``````double tan(double y);

double sin(double y);``````

## Difference between tan and cos in c

tan in c is a mathematical function that is used to find the tangent of a given number. cos is a mathematical function that is used to find the cosine of a given number.

Prototypes are as follows

``````double tan(double y);

double cos(double y);``````