<html>
<body>
<script type="text/vbscript">
dim n,sum,l,i
i=1
sum=0
n=inputbox("Enter any number")
l=len(n)
document.write("GIVEN NUMBER IS "& n&"<br>")
if (l < 4) then
document.write("LENGTH OF THE NUMBER IS LESS THAN FOUR!!! TRY AGAIN"&"<br>")
else
do while(i<=l)
sum=sum+cint(mid(n,i,1))
i=i+1
loop
end if
document.write("SUM OF THE DIGITS = "&sum)
</script>
</body>
</html>
<body>
<script type="text/vbscript">
dim n,sum,l,i
i=1
sum=0
n=inputbox("Enter any number")
l=len(n)
document.write("GIVEN NUMBER IS "& n&"<br>")
if (l < 4) then
document.write("LENGTH OF THE NUMBER IS LESS THAN FOUR!!! TRY AGAIN"&"<br>")
else
do while(i<=l)
sum=sum+cint(mid(n,i,1))
i=i+1
loop
end if
document.write("SUM OF THE DIGITS = "&sum)
</script>
</body>
</html>
No comments:
Post a Comment