#include<stdio.h>
#include<math.h>
int main()
{
int i,n,degree;
float x, sum=0,term;
printf("Enter the value of degree and n\n");
scanf("%d %d",°ree,&n);
x = degree * (3.1416/180);
term = x;
sum=term;
for (i=3;i<=n;i+=2)
{
term=-term*x*x/((i-1)*i);
sum=sum+term;
}
printf("The sine of %d is %.3f\n", degree, sum);
printf("The sine function of %d using library function is %.3f\n", degree,
sin(x)); return 0;
}
Output
Enter the value of degree and n
30 5
The sine of 30 is 0.500
The sine function of 30 using library function is 0.500