cos()


cos() takes a single argument in radians and returns a value in type double . The value returned by cos() is always in the range: -1 to 1. It is defined in <math.h> header file.




Sample Program:


/*
Write a program to illustrate cos math function of C.
*/

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

main() { 
 double result, x = .25; 
 result = cos(x); 
 printf("The cos(%lf) = %lf\n", x, result); 
 getch(); 
 return 0; 
}

Post a Comment

0 Comments