2 Answers
#include <stdio.h>
#include <math.h>
#define PI 3.142
int main()
{
int n, i;
float deg, x, sum = 0, term = 0;
printf(“Enter number of terms, say n\n”);
scanf(“%d”, &n);
printf(“Enter the degree\n”);
scanf(“%f”, °);
x = (deg * PI) / 180;
printf(“In Radians = %f \n”, x);
term = x;
sum = term;
for (i = 3; i <= n; i += 2)
{
term = (-term * x * x) / (i * (i – 1));
sum = sum + term;
}
printf(“sin(%f)=%f\n”, deg, sum);
printf(“Inbuilt function Sin(%f) = %f \n”, deg, sin(x));
printf(“User function Sin(%f) = %f”, deg, sum);
}