Qbasic Program to reverse the given digits  

Posted by Mahibabu

REM Program to reverse the digits
CLS
INPUT "Enter any digit"; n
WHILE n <> 0
r = n MOD 10
s = s * 10 + r
n = n \ 10
WEND
PRINT "Reversed digits is "; s
END

10 comments

Really useful....... thanks for posting this!

Thanks for the help u have done 2 me

Give a example

Amazing

Make this program using do...loop.

Wow

Can anyone help me to solve this same program using do until loop

Yes this is very nice

Thanks for the program

CLS
INPUT "Enter any digit"; n
Do WHILE n <> 0
r = n MOD 10
s = s * 10 + r
n = n \ 10
Loop
PRINT "Reversed digits is "; s
END

Post a Comment

Contributors

My photo
I am Mahesh Bhandari from Kathmandu, Nepal

Check Nepal's Time