主题:.回文数
TMGY119
[专家分:0] 发布于 2007-09-07 09:58:00
如果从左往右看与从右往左看一个整数,所看到的数是相同的,则称这个整数为回文数.
如1331,4774,9999等.
输入一个数看它是否是回文数
回复列表 (共7个回复)
沙发
snoopy7 [专家分:70] 发布于 2007-09-07 22:34:00
CLS
INPUT n
n$ = MID$(STR$(n), 2)
l = LEN(n$)
FOR i = 1 TO (l + 1) \ 2
IF MID$(n$, i, 1) <> MID$(n$, l + 1 - i, 1) THEN PRINT "no": END
NEXT
PRINT "yes"
END
[em1][em2][em3][em4][em5][em6][em7][em8][em9][em10][em11][em12][em14][em15][em16][em17][em18][em19][em20][em21][em22][em23][em24][em25][em26][em27][em28][em29][em30][em31][em32][em33][em34][em35][em36][em38][em39][em40][em41][em42][em43][em44][em45][em46][em47][em48][em49][em50][em60][em59][em58][em57][em56][em55][em54][em53][em52][em51][em61][em62][em63][em64][em65][em66][em67][em68][em69][em70][em80][em79][em78][em76][em75][em74][em73][em72][em71]
板凳
snoopy7 [专家分:70] 发布于 2007-09-07 22:36:00
加分!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
3 楼
QB爱好者 [专家分:370] 发布于 2007-09-07 22:36:00
CLS
INPUT "N=",A$
F=0
FOR I=1 TO LEN(A$)\2
IF MID$(A$,I,1)<>MID$(A$,LEN(A$)+1-I,1) THEN F=1:EXIT FOR
NEXT I
IF F=0 THEN PRINT "YES" ELSE PRINT "NO"
END
4 楼
QB爱好者 [专家分:370] 发布于 2007-09-07 22:38:00
加分!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5 楼
TMGY119 [专家分:0] 发布于 2007-09-08 08:49:00
感谢你们,程序还没调试.非常感谢
6 楼
我的电脑 [专家分:990] 发布于 2007-09-20 17:58:00
CLS
INPUT N$:F=-1
FOR I=1 TO LEN(N$)\2
IF MID$(N$,I,1)<>MID$(N$,LEN(N$)+1-I,1) THEN F=0:EXIT FOR
NEXT I
IF F THEN PRINT "YES" ELSE PRINT "NO"
END
7 楼
小精灵1号 [专家分:1040] 发布于 2007-09-21 14:23:00
CLS
INPUT A$:L=LEN(A$):DIM A$(L)
FOR I=1 TO L:A$(I)=MID$(A$,I,1):NEXT I
FOR I=1 TO L
IF A$(I)<>A$(L+1-I) THEN PRINT "NO!":END
NEXT I
PRINT "YES"
END
我来回复