QBASIC SERIES : 1,153,370,371,407
1,153,370,371,407
CLS
N = 1
CNT = 1
TOP:
A = N
S = 0
WHILE A < > 0
R = A MOD 10
S = S + R ^ 3
A = A \ 10
WEND
IF N = S THEN
PRINT N,
CNT = CNT + 1
END IF
N = N + 1
IF CNT <= 5 THEN GOTO TOP
END
USING SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
N = 1
CNT = 1
TOP:
A = N
S = 0
WHILE A < > 0
R = A MOD 10
S = S + R ^ 3
A = A \ 10
WEND
IF N = S THEN
PRINT N,
CNT = CNT + 1
END IF
N = N + 1
IF CNT <= 5 THEN GOTO TOP
END SUB
0 Comments