Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

TAN Function in C

by suresh

The C tan Function is a C Math Library Function. It is helpful to calculate the Trigonometry Tangent value for the specified expression. The syntax of the tan in C Programming is

double tan(double number);

Let us see the mathematical formula behind this Trigonometry Tangent function:

Tan(x) = Length of the Opposite Side / Length of the Adjacent Side

TAN Function in C Example

The tan function in the C math library allows you to calculate the trigonometric Tangent for the specified values.

This program asks the user to enter his/her own value. Then it will find the tangent value of the user-specified value

TIP: Please refer to the C ATAN Function article to calculate the Arc Tangent of the specified expression.

/* Example for TAN Function in C Programming */

#include <stdio.h>
#include <math.h>

int main()
{
  double tanValue, number;
  printf(" Please Enter the Value to Calculate Tangent :  ");
  scanf("%lf", &number);
  
  tanValue = tan(number);
  
  printf("\n The Tangent, or Tan value of %lf = %f ", number, tanValue);
  
  return 0;
}

OUTPUT

TAN Function in C programming 1

C TANGENT Function Example 2

This C Programming example allows the user to enter the value in degrees. Next, we are converting the degrees to Radians. And finally, we are finding the Tangent value of the radian

/* Example for TAN Function in C Programming */

#include <stdio.h>
#include <math.h>

#define PI 3.1415926
int main()
{
  double tanValue, radianVal, degreeVal;
  printf(" Please Enter an Angle in degrees :  ");
  scanf("%lf", &degreeVal);
  
  // Convert Degree Value to Radian  
  radianVal = degreeVal * (PI/180);
  tanValue = tan(radianVal);
  
  printf("\n The Tangent, or Tan value of %f = %f ", degreeVal, tanValue);
  
  return 0;
}

OUTPUT

TAN Function in C programming 2

Placed Under: C Programming

  • C Comments
  • C Escape Sequence
  • C Programming Operators
  • C Arithmetic Operators
  • C Assignment Operators
  • C Bitwise Operators
  • C Conditional Operator
  • C Increment & Decrement Optr
  • C Logical Operators
  • C Relational Operators
  • C Sizeof Operator
  • C If Statement
  • C IF ELSE Statement
  • C Else If Statement
  • C Nested If
  • C Break Statement
  • C Continue Statement
  • C Goto Statement
  • C Switch Case
  • C For Loop
  • C While Loop
  • C Do While Loop
  • C Arrays
  • C Two Dimensional Array
  • C Multi Dimensional Array
  • C String
  • C Structures
  • C Nested Structures
  • C Array of Structures
  • C Structures and Functions
  • C Union
  • C Structure & Union differences
  • C Pointers
  • C Pass Pointers to Functions
  • C GETS
  • C fgets Function
  • C fgetc
  • C fputs function
  • C fputc
  • C Functions
  • C Types of Functions
  • C Pass Array to Functions
  • Call By Value & Call By Reference
  • C Recursion
  • C Program Examples
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy