C Tutorial/math.h/cos

Материал из C\C++ эксперт
Перейти к: навигация, поиск

cos

Item Value Header file math.h Declaration float cosf(float arg);double cos(double arg);long double cosl(long double arg); Function returns the cosine of arg. Parameter arg must be in radians.


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