QBASIC PROGRAM TO FIND REVERSE OF A NUMBER

QBASIC PROGRAM TO FIND REVERSE OF A NUMBER


TO PRINT DIGITS IN REVERSE ORDER


CLS
 INPUT ENTER ANY NUMBER; N
 S = 0
 WHILE N < > 0
 R = N MOD 10
 S = S * 10 + R
 N = N  10
 WEND
 PRINT "REVERSED DIGITS="; S
 END

USING SUB


DECLARE SUB REVERSE(N)
 CLS
 INPUT ENTER ANY NUMBER; N
 CALL REVERSE(N)
 END
 
 SUB REVERES(N)
 S = 0
 WHILE N < > 0
 R = N MOD 10
 S = S * 10 + R
 N = N  10
 WEND
 PRINT "REVERSED DIGITS="; S
 END SUB

Post a Comment

0 Comments