You are here:   HomeC Programming (Pratical)C Program Trace a Matrix

# C Program Write a Program For Sine Series

by Dinesh Thakur Category: C Programming (Pratical)

In this program user ask to compute Sine (trigonometric function) Series. The Variable of float or integer type declared that will be use to contain the value. User asks to enter the value and then the computation of PI function described. Here term variable used for temporary value container as in the program this variable contain the x1 and then swapped for Sine. For loop statement also been used for varying the condition. Then using compatible condition the output is displayed.

Problem Statement:
The trigonometric Symbol Sine Series to be computed through a C program.

1. Declare Value of PI and ACC.
2. Used Computation algorithm.
3. Using Loop Statement.
4. Display result On the Screen.

Here is source code of the C program to compute the Sine Series. The C program is successfully compiled. The program output is also shown below.

```#include<stdio.h>

#include<conio.h>

#include<math.h>

#define ACC 0.000001

#define PI 3.14

void main()

{

int x,i;

float x1,x2,sine=0,term;

clrscr();

printf("Enter the X value : ");

scanf("%d",&x);

x1=(x*PI)/180;

x2=x1*x1;

term=x1;

sine=term;

for(i=3;fabs(term)>ACC;i=i+2)

{

term = (x2*(-term))/(i*(i-1));

sine = sine+term;

}

printf("\n%f",sine);

getch();

}

Output :

Enter the X value : 100

0.984961

```

Search Content

Basic Courses