INPUT "n=", n
a = n - INT(n / 10) * 10
b = (n - a) / 10 - INT((n - a) / 100) * 10
c = ((n - a) / 10 - b) / 10 - INT(n / 1000) * 10
d = INT(n / 1000)
a = a + 7 - INT((a + 7) / 10) * 10
b = b + 7 - INT((b + 7) / 10) * 10
c = c + 7 - INT((c + 7) / 10) * 10
d = d + 7 - INT((d + 7) / 10) * 10
SWAP a, d
SWAP b, c
m = a + 10 * b + 100 * c + 1000 * d
PRINT "m="; m
程序经调试运行正常。
INPUT x
a=x/1000
b=(x-a*1000)/100
c=(x-a*1000-b*100)/10
d=x-a*1000-b*100-c*10
e=(a+7) MOD 10
f=(b+7) MOD 10
g=(c+7) MOD 10
h=(d+7) MOD 10
z=h*1000+g*100+f*10+e
PRINT z
END