QBASIC Program To Reverse The Digits Of A Number
QBASIC Program To Reverse The Digits Of A Number
CLS
INPUT" Enter a number"; N
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
PRINT " The reverse number is ";A
END
QBASIC Program To Reverse The Digits Of A Number Using SUB Procedure
DECLARE SUB REV(N)
CLS
INPUT" Enter a number"; N
CALL REV(N)
END
SUB REV(N)
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
PRINT " The reverse number is ";A
END SUB
QBASIC Program To Reverse The Digits Of A Number Using FUNCTION Procedure
DECLARE FUNCTION REV(N)
CLS
INPUT" Enter a number"; N
PRINT"The reverse number is"; REV(N)
END
FUNCTION REV(N)
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
REV=A
END FUNCTION
Comments
Post a Comment