/* File: sinelaw.c Calculate side c based on the sine law, given side a and two angles alpha and gamma */ #include #include /* for macro M_PI and function sin() in the C standard math lib */ int main() { /* declare variables for sides and angles of a triangle */ double a, c, alpha, gamma; a = 10.0; /* side a */ alpha = 90.0*M_PI/180; /* change 90 degrees into radian */ gamma = 60.0*M_PI/180; /* change 60 degrees into radian */ /* compute side c based on sine law and display the result */ c = a*sin(gamma)/sin(alpha); printf("c = %f\n", c); return 0; }