Guruh talabasi Baxriddinova Muxlisa 1-misol


Download 16.89 Kb.
Sana30.04.2023
Hajmi16.89 Kb.
#1402464
Bog'liq
Muxlisa


110-20 guruh talabasi Baxriddinova Muxlisa
1-misol
n = int(input()) # n ni o'qing
a = 1 # a_0 qiymati
for k in range(1, n+1):
a = a*k + 1/k # a_k ni hisoblash
print(a) # a_n ni ekranga chiqaring
2-misol
def find_vn(n):
v1 = 0
v2 = 0
v3 = 1.5
vi_minus_1 = v3
vi_minus_2 = v2
vi_minus_3 = v1
for i in range(4, n+1):
vi = (i + 1) * vi_minus_1 / ((i ** 2) + 1) - (vi_minus_2 * vi_minus_3)
v1 = v2
v2 = v3
v3 = vi
vi_minus_1 = v3
vi_minus_2 = v2
vi_minus_3 = v1
return v3

n = int(input("n ni kiriting: ")) # n natural sonini foydalanuvchidan oling


vn = find_vn(n)
print(f"vn = {vn}")
3-misol
def find_ai(n, l):
a = [l, l] # a0 va a1 qiymatlari
for i in range(2, n+1):
ai = a[i-2] + a[i-1] / (2 * i - 1)
a.append(ai)
return a

n = 14 # n = 14, chunki a0 * a1 * ... * a14 ni topish kerak


l = float(input("l ni kiriting: ")) # a0 va a1 ning boshlang'ich qiymatini foydalanuvchidan oling
a = find_ai(n, l)
product = 1
for ai in a:
product *= ai

print(f"a0 * a1 * ... * a14 = {product}")
Download 16.89 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling