主题:u
016565
[专家分:0] 发布于 2009-07-30 12:26:00
输出100~999内的水仙花数并统计
回复列表 (共3个回复)
沙发
FFKK [专家分:1610] 发布于 2009-07-30 12:39:00
DIM A AS INTEGER, B AS INTEGER, C AS INTEGER, N AS INTEGER, X AS INTEGER,Y AS INTEGER
CLS
FOR I=1 TO 9
FOR J=0 TO 9
FOR K=0 TO 9
X=A*A*A+B*B*B+C*C*C
Y=A*100+B*10+C
IF X=Y THEN
N=N+1
? "N=";N,X
END IF
NEXT C
NEXT B
NEXT A
END
板凳
FFKK [专家分:1610] 发布于 2009-07-30 12:42:00
上面的帖子nexxt 应该是 KJI
CLS
N=0
FOR I=100 TO 999
A=INT A(A/100)
B=INT AERRE
3 楼
FFKK [专家分:1610] 发布于 2009-07-30 12:47:00
CLS
N=0
FOR I=100 TO 999
A=INT (X/100)
B=INT ((X-100*A)/10)
C= X- INT(X/10)*10
IF X=A*A*A+B*B*B+C*C*C THEN
N=N+1
? "N=";N,X
END IF
NEXT I
END
我来回复