Tuesday, September 18, 2018

Qbasic programs to reverse the digits

                        # Write a program to reverse the digits 


        CLS
        INPUT "enter any number";N
        S = 0
       WHILE N< > 0
       R = N MOD 10
       S = 10 + R
       N = N \ 10
       WEND
       PRINT "Reverse digits ="; S
       END

1 comment:

  1. mistake s=10+r
    the correct one is s=s*10+r
    will u correct this line

    ReplyDelete