PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""A gapful number is a number of at least 3 digits that is divisible by the number formed by the first and last digit of the original number.
For Example:
192
is gapful because it is divisible 12
583 is gapful because it is divisible by 53
210 is not gapful because it is not divisible by 20
It's a program to check if the user input is a gapful number or not.
Bonus: enter second "input" and you will see all the gapful numbers in a range from 100 until number you inputted.
"""
number = input()
if int(number) < 100:
print ('Number should be >= 100')
raise ValueError
elif int(number) % (int(number[:1:] + number[-1::]))==0:
print("Gapful number")
else:
print("Not gapful")
for number in range(100, int(input())):
if int(number) % (int(str(number)[:1:] + str(number)[-1::]))==0:
print(number)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run