Cos Function


  • It is used for getting the Cosine value of the argument .
  • The argument must be in Radian .

  • Syntax:

    float cosf(float arg);
    
    double cos(double arg);
    
    long double cosl(long double arg);

    Example:

    #include <math.h>
    #include <stdio.h>
    
      int main()
      {
        double x = -2.0;
    	
        do {
          printf("Cosine of %f is %f.\n", x, cos(x));
          x += 0.2;
        } while(x<=2.0);
    
        return 0;
      }     
      
    Back