用Python语言求水仙花数

代码:

y = 100
a = int( input( “百位” ) )
b = int( input( “十位” ) )
c = int( input( “个位” ) )
while (y <= 999) :
a = y // 100
b = y // 10 % 10
c = y % 10
if a * a * a + b * b * b + c * c * c == y :
print( “水仙花数:” + y )
print( y , end=’ ’ )

发布了50 篇原创文章 · 获赞 0 · 访问量 636

猜你喜欢

转载自blog.csdn.net/m0_45133750/article/details/104360328