Latest web development tutorials

C-Bibliotheksfunktionen - cos ()

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>

Beschreibung

C - BibliotheksfunktionenDoppel cos (double x) Gibt den Kosinus von xRadiant.

Erklärung

Hier ist sie () Anweisung cos-Funktion.

double cos(double x)

Parameter

  • x - Gleitkommawert repräsentiert einen Winkel in Radiant.

Rückgabewert

Diese Funktion gibt den Cosinus von x.

Beispiele

Das folgende Beispiel veranschaulicht die cos () Funktion verwendet wird.

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

#define PI 3.14159265

int main ()
{
   double x, ret, val;

   x = 60.0;
   val = PI / 180.0;
   ret = cos( x*val );
   printf("%lf 的余弦是 %lf 度\n", x, ret);
   
   x = 90.0;
   val = PI / 180.0;
   ret = cos( x*val );
   printf("%lf 的余弦是 %lf 度\n", x, ret);
   
   return(0);
}

Lassen Sie uns zusammenzustellen und um das obige Programm ausführen, die in der folgenden führen:

60.000000 的余弦是 0.500000 度
90.000000 的余弦是 0.000000 度

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>