Related Articles

# Python program to find the sum of sine series

• Difficulty Level : Easy
• Last Updated : 10 May, 2021

Prerequisite: math

Given n and x, where n is the number of terms in the series and x is the value of the angle in degree. The Task here is, write a program to calculate the sum of sine series of x.

Formula Used:

Example:

```Input: n = 10
x = 30
Output: sum of sine series is 0.5

Input: n = 10
x = 60
Output: sum of sine series is 0.87```

Below is the program to calculate the sum of sine series:

## Python3

 `# Import Module``import` `math` `# Create sine function``def` `sin( x, n):``    ``sine ``=` `0``    ``for` `i ``in` `range``(n):``        ``sign ``=` `(``-``1``)``*``*``i``        ``pi ``=` `22``/``7``        ``y ``=` `x``*``(pi``/``180``)``        ``sine ``+``=` `((y``*``*``(``2.0``*``i``+``1``))``/``math.factorial(``2``*``i``+``1``))``*``sign``    ``return` `sine` `# driver nodes``# Enter value in degree in x``x ``=` `10` `# Enter number of terms``n ``=` `90` `# call sine function``print``(``round``(sin(x,n),``2``))`

Output:

`0.17`

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with experts, please refer DSA Live Classes for Working Professionals and Competitive Programming Live for Students.

My Personal Notes arrow_drop_up