Created
March 18, 2011 18:28
-
-
Save hasayvaz/876581 to your computer and use it in GitHub Desktop.
fibonacci serisini göze alarak, serideki değerlerin hepsinin toplamını bulan program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| #-*-coding:utf-8-*- | |
| def fibo(n): | |
| if n == 0: | |
| return 0 | |
| elif n == 1: | |
| return 1 | |
| elif n > 1: | |
| return fibo(n - 1) + fibo(n - 2) | |
| else: | |
| print "lutfen negatif olmayan bir sayı giriniz " | |
| a = [] | |
| top = 0 | |
| sayi = input("fibonacci serisi hesaplanacak sayı giriniz : ") | |
| for t in range(sayi): | |
| fibo(t) | |
| a.append(fibo(t)) | |
| for h in a: | |
| top += h | |
| print "fibonacci dizisi : ", a | |
| print "fibonacci dizisindeki değerlerin toplamı : ", top |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment