Using sin(), cos(), and tan() functions

Tuesday, October 14, 2014
/* 0904.c: Using sin(), cos(), and tan() functions */
#include <stdio.h>
#include <math.h>

main()
{
    double x;

    x = 45.0; /* 45 degree */
    x *= 3.141593 / 180.0; /* convert to radians */
    printf("The sine of 45 is: %f.\n", sin(x));
    printf("The cosine of 45 is: %f.\n", cos(x));
    printf("The tangent of 45 is: %f.\n", tan(x));
    return 0;
}

Copyright @ 2015 Tron!

Labels

Blog Archive