sin


sin

Calculates the sine of an angle

 #include <math.h> double sin ( double x  ); double sinf ( float x  );         (C99) double sinl ( long double x  );         (C99) 

The sin( ) function calculates the sine of the angle represented by its argument x as a number of radians. The return value is in the range -1 sin(x) 1.

Example

 #define DEG_PER_RAD ( 180.0 / PI ) const double PI = 4.0 * atan( 1.0 ); double a[4]; printf( "\nEnter an acute angle measure, in degrees: " ); if ( scanf( "%lf", a ) < 1 ||  ( a[0] <= 0 || a[0] >= 90 ) )   printf( "\nThat's not an acute angle.\n" ), exit( 1 ); else {   a[1] = a[0] + 90 ;   a[2] = 180 - a[0] ;   a[3] = 225 + a[0] ;   for ( int i = 0 ; i < 4 ; i ++ )     printf( "The sine of %4.2lf degrees is %6.4lf.\n",             a[i], sin( a[i] / DEG_PER_RAD ) ); } 

See Also

cos( ), tan( ), asin( ), csin( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net