C++ Programming/Code/Standard C Library/Functions/sin

Syntax
#include <cmath>
double sin( double arg );

If you don't want cmath you can write sin function it is;

  1. include <iostream>

using namespace std;

double sin(double x) //sin function {return x-((x*x*x)/6.)+((x*x*x*x*x)/120.);}

int main () {

   double a;
   cin>>a;
 
                                                           cout<<"sin("<<a<<")="<<sin(a*(3.14159/180.))<<endl;

return 0;}


The function sin() returns the sine of arg, where arg is given in radians. The return value of sin() will be in the range [-1,1]. If arg is infinite, sin() will return NAN and raise a floating-point exception.

Related topics
acos - asin - atan - atan2 - cos - cosh - sinh - tan - tanh