Write PYTHON program, which will print those numbers whose last digit is between 5 and 9.
e.g. 5, 6, 7, 8, 15, 16, 17, 18, 25, 26, ….
Answers
Answered by
1
nums = [str(n) for n in range(5, 1000) if 5 <= n % 10 <= 9]
print("\n".join(nums))
Answered by
0
Answer: x = int(input("Enter Range : "))
for i in range (1,x):
if (i % 10) < 5:
i += 1
elif ((i % 10) >= 5) and ((i % 10) <9):
print(i)
Explanation:
Similar questions