Function 水仙花数(a)
dim b=CInt(Mid(a,1,1))
dim c=CInt(Mid(a,2,1))
dim d=CInt(Mid(a,3,1))
If b^3 + c^3+d^3 = b*100+c*10+d*1 Then
水仙花数(a) =true
TracePrint "水仙花开"
Else
水仙花数(a) = False
TracePrint "水仙花败"
End If
End Function
TracePrint 水仙花数(153)
点评
神梦科技
👍非常棒了!水仙花数是三位数,如果不限位数的话叫自恋数字
发表于 2022/4/23 13:39:27