Skip to content

Instantly share code, notes, and snippets.

@dmitryTsatsarin
Last active April 26, 2016 18:46
Show Gist options
  • Save dmitryTsatsarin/8dbfa0f497a41c7631df9868281ddf2c to your computer and use it in GitHub Desktop.
Save dmitryTsatsarin/8dbfa0f497a41c7631df9868281ddf2c to your computer and use it in GitHub Desktop.
# coding=utf-8
#Задание 1
#Даны числа a и b (a < b). Выведите сумму всех натуральных чисел от a до b (включительно).
while True:
print("Условие: a < b")
a = int(input("Введите число а: "))
b = int(input("Введите число b: "))
if a < b:
s = 0
print("a < b числа удовлетворяют! Продолжаем:")
for x in range(a, b+1):
print("x = ", x)
s += x
print("s = ", s)
else:
print("a > b числа введены неверно! Попробуйте снова: ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment