Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in getting sum of numbers program
#2
Solved: 10 Years, 4 Months, 1 Week ago
Hi,
i have updated your for loop code, it is working now
Code:
Dim num,sum,getdigit
sum=0
getdigit=""
num=Inputbox("Enter a four digit number")
If Len(num) <> 4 Then
Msgbox("Number is not four digit no")
else
For i=0 to Len(num)-1
getdigit=Mid(num,i+1,1)
'MsgBox(getdigit)
sum = sum+cInt(getdigit)
next
MsgBox("Sum of the digits is " & sum)
End if
Reply
Jump to the post that solved this thread.


Messages In This Thread
RE: Error in getting sum of numbers program - by kotaramamohana - 07-15-2014, 01:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to increase numbers for value in Excel Jyobtech 2 3,554 10-26-2012, 04:56 PM
Last Post: Jyobtech
  display any 10 numbers in ascending order using arrays in vb scripting haritha 4 24,247 01-03-2012, 05:46 PM
Last Post: shivu.hanu
  "How to write Batch Script runner program" suresz449 2 3,969 12-19-2011, 05:15 PM
Last Post: Munna.Sarfraz
  "VBScript Program" suresz449 0 2,727 12-19-2011, 09:55 AM
Last Post: suresz449
  Write a program to Capture Desktop Screen shot kumarmoyilla 2 11,720 07-11-2011, 10:51 AM
Last Post: souvikghosh_diatm

Forum Jump:


Users browsing this thread: 1 Guest(s)