编写程序:打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身.
问题描述:
编写程序:打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身.
答
vb:Private Sub Form_Click() Dim a,b,c ,x As Integer For a = 0 To 9 For b = 0 To 9 For c = 1 To 9 x=100 * c + 10 * b + a If a ^ 3 + b ^ 3 + c ^ 3 = a + 10 * b + 100 * c Then print x; Next c Next b Nex...