Напишите программу, которая считывает с клавиатуры два числа a и b, считает и выводит на консоль среднее арифметическое всех чисел из отрезка [a; b], кратных числу c.
Советы и рекомендации
Функция range(start, stop) не включает границу stop, останавливается, не доходя до неё.
Решение задачи:
a = int(input(‘Введите число а: ‘)) b = int(input(‘Введите число b: ‘)) c = int(input(‘Введите число с: ‘)) summ = 0 count = 0 for i in range(a, b +1): if i % c == 0: count += 1 summ += i if count == 0: print(‘Расчет невозможен, так как нет подходящих чисел’) else: print(summ / count)
Источник: it-systems.su
надо написать программу которая сравнивает два числа, введенных с клавиатуры. Программа должна указать, какое число больше или если числа равны вывести соответствующие сообщение. Ниже представлен рекомендуемый вид экрана во время работы программы.Введите в одной строке два целых числа и нажмите . ->34 67
What are they interested in? For questions 1-7, choose the correct answer a, b or с. There is an example (0) at the beginning.
Урок 2 Читаем числа с клавиатуры Java Scanner
— Would you like to (0) tour Europe during your holidays?
— No, thank you, we are looking for a 10 or 15 days’ (1) _______ in the Pacific Ocean.
— There is a wonderful trip around Australia and New Zealand.
— Great! Is it (2) _____________?
— About 2000 dollars. (3) ___________ to Australia by ship?
— No, it’s a long way. We think we (4)______to Australia by plane.
— That’s fine. I think you can travel (5)_______ the ship The Sun Princess. It’s a wonderful place to (6) _________ and have fun.
— Are there any special activities for children? (7) _______ our own games for our 8-year-old son?
— No, you needn’t, they are happy to have children on board! Your son (8) _____________ play water games, take part in toy boat races and beach parties. There is a children’s only pool on the ship. Maybe he (9) _____________ in the swimming competition.
— Well, the voyage starts on 15 August. Then we (10) _________ Australia on 14 August.
— Fine. I hope you (11) _________ your trip.
3 a Are you going
с When are you going
4 a are going to go / are going to fly
b will go / will fly
с are going / are flying
7 a Are we taking
с Shall we take
9 a will take part
b is going to take part
с is taking part
10 a are going to arrive in
b are arriving at
c are arriving in
11 a are going to enjoy
Источник: znanija.site
Написать программу которая сравнивает два числа введенных с клавиатуры и выводит
Скачай курс
в приложении
Перейти в приложение
Открыть мобильную версию сайта
Наши условия использования и конфиденциальности
Public user contributions licensed under cc-wiki license with attribution required
Источник: stepik.org