急求VB编程!

[复制链接]
查看11 | 回复2 | 2009-5-23 09:36:06 | 显示全部楼层 |阅读模式
dim n as integer,i as integer,s as longn=inputbox("请输入n的值:")for i=10 to 99 '2位的Armstrong数s=(i mod 10)^n+(i\10)^nif i=s then print i;next iprintfor i=100 to 999 '3位的Armstrong数s=(i mod 10)^n+(i\100)^n+((i mod 100)\10)^nif i=s then print i;next iprintfor i=1000 to 9999 '4位的Armstrong数s=(i mod 10)^n+(i\1000)...
回复

使用道具 举报

千问 | 2009-5-23 09:36:06 | 显示全部楼层
dim i as integer ,j as integer,arm as integerfor i=10 to 9999
for j=1 tolen(str(I))
arm=arm+ val(mid(i,j,1))^2
next j
if arm=i then
print i
...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行