## 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;
}
```

While using gcc use below command to add math header.

`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.

## 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);
```

tan in c | tanh in c |

Used to find tangent of a given number. | Used to find hyperbolic tangent of given number. |

`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);
```

tan in c | sin in c |

Used to find tangent of a given number. | Used to find sine of a given number. |

`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);
```

tan in c | cos in c |

Used to find tangent of a given number. | Used to find cosine of a given number. |

`double tan(double y);` | `double cos(double y);` |

## People also ask for

### What is the tan equation?

It is a trigonometric function. tan of an angle m is the length of the opposite side divided by the length of the adjacent side.