Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def gange():
- print ("Ganjil Genap")
- bil=int(raw_input("Masukan Sebuah Bilangan : "))
- if (bil%2)==0:
- print("Bilangan Genap")
- else:
- print("bilangan Ganjil")
- def faktorial(n):
- if n == 0 or n == 1:
- return 1
- else:
- return n * faktorial(n-1)
- def fibonnaci():
- print ("Program Fibonnaci")
- x=input("Masukkan Banyaknya Perulangan : ")
- z=1
- temp=1
- print z,
- for i in range(1,x,1):
- z,temp=temp,temp+z
- print z,
- def menu():
- while True:
- print ""
- print ("=========MENU========")
- print "1. Ganjil Genap"
- print "2. Faktorial"
- print "3. Deret Fibonnaci"
- print "4. Exit"
- print "====================="
- pil=int(input("Masukkan Pilihan Yang Tersedia : "))
- if pil==1:
- gange()
- elif pil==2:
- a = int(input("Masukan jumlah faktorial : "))
- print faktorial(a)
- elif pil==3:
- fibonnaci()
- elif pil==4:
- break
- else :
- print "Pilihan Tidak Tersedia"
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement