for water_num in range(100, 1000):
sum = 0
temp = water_num
while temp:
sum = sum + (temp % 10) ** 3
temp //= 10
if sum == water_num:
print(water_num)
python编写一个程序,求解 100~999 之间的所有水仙花数。
于 2023-12-06 14:06:26 首次发布