Предмет: Информатика,
автор: Parampam123
Даны два числа. Если оба числа отрицательные, постройте программу, которая найдет сумму их квадратов.
Даны два числа. Если оба числа положительные, постройте программу, которая найдет их среднее арифметическое.
Помогите пожалуйста, даю 30 баллов.
Ответы
Автор ответа:
4
МОЖНО ПОЖАЛУЙСТА ЛУЧШИЙ ОТВЕТ!
python:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a < 0 and b < 0:
print("The sum of squares of the numbers is:", (a**2 + b**2))
elif a > 0 and b > 0:
print("The average of the numbers is:", (a + b) / 2)
else:
print("One of the numbers is negative, try again with two negative numbers.")
python:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a < 0 and b < 0:
print("The sum of squares of the numbers is:", (a**2 + b**2))
elif a > 0 and b > 0:
print("The average of the numbers is:", (a + b) / 2)
else:
print("One of the numbers is negative, try again with two negative numbers.")
Похожие вопросы
Предмет: Английский язык,
автор: beksultaninkar4
Предмет: Математика,
автор: ralina10012014
Предмет: Математика,
автор: platonzaripov9
Предмет: Математика,
автор: kata69215
Предмет: Українська мова,
автор: Ananastea17