|
Description
This shows a couple
of examples of the cos() function
. This returns the cosine of an angle
in radians . The range returned is
-1.0 to 1.0 .
Code
#include <stdio.h>
#include <math.h>
int main()
{
printf("The cosine of
%f is %f.\n",0.5,cos(0.5));
printf("The cosine of %f is %f.\n",1.0,cos(1.0));
printf("The cosine of %f is %f.\n",-1.0,cos(-1.0));
return 0;
}
Information
tested using LCC Win
32
|