C Reference function cos()

Usage of cos():

double cos(double x);

Parameters:

The value of x has no range.

Return value:

The returned value is in the range of -1 to +1 (inclusive).

Source code example of cos():


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

	#define PI 3.14159265

	main()
	{
		double input, output;
		input = 60.0;
		output = cos (input*PI/180);
		printf ("Cosine of %lf degrees is %lf.\n", input, output );
		return 0;
	}

Output of the cos example program above:


	Cosine of 60.000000 degrees is 0.500000

This entry was posted in C Reference math.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.