Evaluate ‘sin x’ as sum of a series

Evaluate ‘sin x’ as sum of a series


Input: Number whose sine function is to be computed: X.

Number of iterations to be carried out: N.

Output : Sine of the given Number

Step 1: Input: Number whose sine function is to be computed: X.

Number of iterations to be carried out: N.

Step 2: Initialize Sum = 0.

Den = 1.

Step 3 : If N is Equal to One (1),

Yes: Output Sin(x) is X.

No: Step 4.

Step 4: Initialize Flag =1.

Fact = 1

Assign X = Y.

Step 5: Add Sum to flag multiplied by X divided by Fact and assign to sum: (Sum = (Flag * X)/Fact).

Assign the product of X and the Square of Y to X: (X = X * Y ^ 2).

Negate the sign of the flag.

Compute the product of Fact, Den and Den+1 and assign to Fact: (Fact = Fact*Den* (Den+1)).

Increment Den by 2.

Decrement N by 1.

Repeat Step 5 N times.

Step 6: Output the Sum.

Programs

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad