Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Girilen İki Sayı Arasındaki Tek Sayıları ve Ortalamasını Yazdıran Kod #836

Open
wants to merge 1 commit into
base: 54.Döngü-sorusu
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions DonguSorusu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
while True:
sayi1 = int(input("Birinci sayıyı girin: "))
sayi2 = int(input("İkinci sayıyı girin: "))

if sayi1 < sayi2:
m = sayi1
n = sayi2
break
elif sayi1 > sayi2:
m = sayi2
n = sayi1
break
else:
print("İki sayıyı aynı girdiniz. Lütfen birbirinden farklı iki sayı \
girin!..")

sayac = 0
toplam = 0

print("\n{} ile {} arasındaki tek sayılar:".format(m, n))

for sayi in range(m, n+1):
if sayi % 2 == 1:
sayac += 1
toplam += sayi
print(sayi, end=" ")

print("\n\n{} ile {} arasındaki tek sayılar'ın ortalaması:".format(m, n),
toplam/sayac)