Wednesday, October 16, 2019

69. Qbasic program to display all palindrome numbers from 1 to 200.


69.      Write a sub program to display all palindrome numbers from 1 to 200.

DECLARE SUB PALIN ( )
CLS
CALL PALIN
END

SUB PALIN
N = 1
FOR I = 1 TO 200
A = N
S = 0
WHILE A < > 0
R = A MOD 10
S = S * 10 + R
A = A \ 10
WEND
IF N = S THEN PRINT N,
N = N + 1
NEXT I
END SUB

No comments:

Post a Comment