test
This commit is contained in:
29
task_13.py
Normal file
29
task_13.py
Normal file
@@ -0,0 +1,29 @@
|
||||
a = int(input("Введите число a: "))
|
||||
b = int(input("Введите число b: "))
|
||||
|
||||
total_sum = 0
|
||||
for num in range(a, b + 1):
|
||||
total_sum += num
|
||||
print(f"Сумма: {total_sum}")
|
||||
|
||||
product = 1
|
||||
for num in range(a, b + 1):
|
||||
product *= num
|
||||
print(f"Произведение: {product}")
|
||||
|
||||
count = b - a + 1
|
||||
average = total_sum / count
|
||||
print(f"Среднее арифметическое: {average:.2f}")
|
||||
|
||||
odd_product = 1
|
||||
odd_count = 0
|
||||
for num in range(a, b + 1):
|
||||
if num % 2 != 0:
|
||||
odd_product *= num
|
||||
odd_count += 1
|
||||
|
||||
if odd_count > 0:
|
||||
geometric_mean = odd_product ** (1 / odd_count)
|
||||
print(f"Среднее геометрическое нечетных: {geometric_mean:.2f}")
|
||||
else:
|
||||
print("Нечетных чисел нет")
|
||||
Reference in New Issue
Block a user