To Display Reverse of Digits
CLS
INPUT "Enter any number"; N
S = 0
WHILE N <> 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
PRINT "Reverse of digits="; S
END
INPUT "Enter any number"; N
S = 0
WHILE N <> 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
PRINT "Reverse of digits="; S
END
To Display Product of Digits
CLS
INPUT "Enter any number"; N
P = 1
WHILE N <> 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PRINT "Product of digits="; P
END
INPUT "Enter any number"; N
P = 1
WHILE N <> 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PRINT "Product of digits="; P
END
To Display Sum of Digits
INPUT "Enter any number"; N
S = 0
WHILE N <> 0
R = N MOD 10
S = S + R
N = N \ 10
WEND
PRINT "Sum of digits="; S
END
No comments:
Post a Comment