# C program to find the value of sin(x)

Write a C program to find the value of sin(x) using the series up to the given accuracy (without using user defined function) Also print sin(x) using library function. Read more about C Programming Language.

```/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
*                                  Happy Coding
***********************************************************/

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

void main()
{
int n, x1;
float  acc, term, den, x, sinx=0, sinval;

clrscr();

printf("Enter the value of x (in degrees)n");
scanf("%f",&x);

x1 = x;

/* Converting degrees to radians*/

x = x*(3.142/180.0);
sinval = sin(x);

printf("Enter the accuary for the resultn");
scanf("%f", &acc);

term = x;
sinx = term;
n = 1;

do
{
den = 2*n*(2*n+1);
term = -term * x * x / den;
sinx = sinx + term;
n = n + 1;

} while(acc <= fabs(sinval - sinx));

printf("Sum of the sine series         = %fn", sinx);
printf("Using Library function sin(%d) = %fn", x1,sin(x));

}         /*End of main() */```
```Read more Similar C Programs
C Basic

Search Algorithms.```

You can easily select the code by double clicking on the code area above.