DECLARE FUNCTION digitsum(n)
CLS
INPUT "Enter testing number=";v
PRINT "Sum of ";n;" is "; digitsum(v)
END
FUNCTION digitsum(n)
a=n
WHILE NOT a=0 'writing NOT a=0 is same as writing a<>0
r=n MOD 10
s=s+r
n=int(n/10)
WEND
digitsum=s
END FUNCTION
plz tell me another method using for...next ,,, mod / \
ReplyDelete