last lab
This commit is contained in:
14
labPython/lab3/TextFile13.py
Executable file
14
labPython/lab3/TextFile13.py
Executable file
@@ -0,0 +1,14 @@
|
||||
def sum(A:int)->int:
|
||||
A = A * (1 - 2 * (A < 0))
|
||||
# A=abs(A)
|
||||
if A//10 > 0:
|
||||
return A%10 + sum(A//10)
|
||||
else:
|
||||
return A
|
||||
|
||||
num_end = int(input())
|
||||
num_multiply = int(input())
|
||||
with open("e.txt", "w") as file:
|
||||
for i in range(2, num_end+1):
|
||||
if sum(i) == sum(i*num_multiply):
|
||||
file.write(f"{i}\n")
|
||||
Reference in New Issue
Block a user