Operation on Digits with SUB and FUNCTION Procedure
1. WAP to find the sum of digits. => DECLARE SUB SUM(N) CLS INPUT "ENTER ANY NUMBER";N CALL SUM(N) END SUB SUM(N) S = 0 WHILE N<>0 R = N MOD 10 S = S + R N = N \ 10 WEND PRINT "SUM OF DIGITS = "; S END SUB =>DECLARE FUNCTION SUM(N) CLS INPUT "ENTER ANY NUMBER"; N PRINT "SUM OF DIGITS = "; SUM(N) END FUNCTION SUM(N) S = 0 WHILE N<>0 R = N MOD 10 S= S+R N = N \10 WEND SUM = S END FUNCTION ____________________________...