Ministério da Educação
Brasil um país de todos
Personal tools
Navigation
Log in


Forgot your password?
 
Document Actions

lista3q8-seno2.py

by Cicero Garrozi last modified 2015-09-10 07:49

Click here to get the file

Size 1 kB - File type text/python-source

File contents

import math #importando a biblioteca math
x = float(input("Digite o valor de x em graus: "))
n = int(input("Digite o valor de n (qtde de termos): "))

seno = 0.0
#convertendo x de graus para radianos:
x = math.pi*x/180
for i in range(n):
    #calculando o termo "i":
    a = i*2 +1
    #calculando fatorial de um numero "a"
    fat = 1
    for p in range(a, 1, -1):
        fat *= p

    seno += (x**a)*((-1)**i)/fat
    
print("O valor do seno e: ", seno)

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: