C program to find sin(x), when x is given in degrees

To find the value of sin(x) when x is given in degrees we must know 2 things :
1. The library function sin(x) takes the argument in radians, so we have to 1st convert the degrees into radians.
2. The constant M_PI, which is included in “math.h” and has the value of the constant pi.
On knowing these things, the program becomes quite simple :

The exe file can be downloaded from here : SINE

#include "stdio.h"
#include "math.h"

int main()
   double result,degrees,radians;
   printf("Enter the no. of degrees : ");
   radians = degrees*(M_PI/180);
   result = sin(radians);
   printf("The sin() of %lf is %lf\n", degrees, result);
   return 0;

Related Posts


Filed Under: CCodes

About the Author: Software Engineer - Advanced Search & Recommendation at Rovi

RSSComments (4)

Leave a Reply | Trackback URL

  1. Gangadhar says:

    Thanks for the source code for the program. We always appriciate the support provided by you.

  2. Asnan says:

    Thank u sir ..!

  3. Fariha says:

    Thanks for the source code.It became very helpful to me.

  4. Tod says:

    is it possible to do it without math library ?

Leave a Reply


AWSOM Powered