Purpose

The trigonometric functions calculate the sine, cosine, or tangent of an angle.

Header File

math.h
(sin, cos, tan)

Prototypes

double sin (double Angle);
double cos (double Angle);
double tan (double Angle);

Argument

Angle
The angle in radians

Return Values

sin
sine (Angle)
cos
cosine (Angle)
tan
tangent (Angle)

Example

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

void Display (double Angle);

int main () {
  Display (.08 * (double)(rand() % 100) - 4.0);
  Display (.08 * (double)(rand() % 100) - 4.0);
  Display (.08 * (double)(rand() % 100) - 4.0);
  return 0;
}

void Display (double Angle) {
  printf ("The sine of %f radians is %f\n",
          Angle, sin (Angle));
  printf ("The cosine of %f radians is %f\n",
          Angle, cos (Angle));
  printf ("The tangent of %f radians is %f\n\n",
          Angle, tan (Angle));
}

Output

The sine of -1.600000 radians is -0.999574
The cosine of -1.600000 radians is -0.029200
The tangent of -1.600000 radians is 34.232533

The sine of 2.560000 radians is 0.549355
The cosine of 2.560000 radians is -0.835589
The tangent of 2.560000 radians is -0.657447

The sine of 3.200000 radians is -0.058374
The cosine of 3.200000 radians is -0.998295
The tangent of 3.200000 radians is 0.058474

See Also

C++ Trigonometry   C++ Now
C# Trigonometry   C# Now
FORTRAN Trigonometry   FORTRAN Now
Java Trigonometry   Java Now
Pascal Trigonometry   Pascal Now
PHP Trigonometry   PHP Now
Trigonometry   Math Now

Valid HTML 4.01 Transitional

Valid CSS

Site Icon Copyright © 1999-2007, jhyoung, revised 5/23/2007