Skip to content

Instantly share code, notes, and snippets.

@hnur
Created March 18, 2011 22:12
Show Gist options
  • Save hnur/876949 to your computer and use it in GitHub Desktop.
Save hnur/876949 to your computer and use it in GitHub Desktop.
verilen sınıra kadar olan fibonacci serisinin çift sayılarını toplar
a = raw_input("sınır sayısını giriniz : ")
sinir = int(a)
def fibo_cift_toplam():
fibo_list =[0, 1,]
for i in range(sinir):
yeni_fibo = fibo_list[i] + fibo_list[i + 1]
fibo_list.append(yeni_fibo)
print fibo_list
toplam = 0
for i in range(sinir):
if fibo_list[i] % 2 == 0:
toplam = toplam + fibo_list[i]
print sinir, "' a kadar olan çift fibonaci elemanlarının toplamaı = ", toplam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment