Skip to content

Instantly share code, notes, and snippets.

@qutal
Created October 3, 2020 22:18
Show Gist options
  • Save qutal/a0acc50de172e7b13543e3ccc10ab3a7 to your computer and use it in GitHub Desktop.
Save qutal/a0acc50de172e7b13543e3ccc10ab3a7 to your computer and use it in GitHub Desktop.
def factorial(c):
if(c==0):
return 1;
res=1
for i in range(2,int(c)+1):
res*=i
return res
x = int(input("Введите x:"))
while(True):
n=int(input("Введите n:"))
if(n<=0):
print('Введите n > 0')
else:
break
y=0
for i in range(0,n):
y += (pow(-1,i)*pow(x,2*i))/factorial(i)
print("Результат: "+str(y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment