TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

C++ Math tan() Function

C++ Math tan() Function with tutorial for beginners and professionals with examples on isgreaterequal(), less(), islessequal(), islessgreater(), isunordered(), exp(), frexp(), ldexp(), log(), log10(), modf(), exp2(), expm1(), log1p(), log2(), logb(), scalbn(), scalbln() etc.

<< Back to CPP

C++ Math tan()

The function finds the tangent of an angle specified in terms of radian.

Syntax

Consider a radian 'x'. Syntax would be:

float tan(float x);
double tan(double x);
long double tan(long double x);
double tan(integral x);

Note: If the value passed is an integral type, then it is cast to double.

Parameter

x: The value given in radian.

Return value

It returns the tangent of an angle given in radian.

Example 1

Let's see the simple example when the value of x is positive.

#include 
#include
using namespace std;
int main()
{
   float degree=10;
   float radian=degree*3.14/180;
   cout<<"Tangent of an angle is : "<

Output:

Tangent of an angle is : 0.176236

In this example, tan() function calculates the tangent of an angle when the value of degree is equal to 10.

Example 2

Let's see the simple example when the value of degree is negative.

#include 
#include
using namespace std;
int main()
{
  float degree= -60;
  float radian=degree*3.14/180;
  cout<<"Tangent of an angle is :"<

Output:

Tangent of an angle is :-1.72993 

In this example, tan() function calculates the tangent of an angle when the value of degree is negative i.e -60.


Next TopicC++ Math Functions




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf