hello,
how can we create a vb 6 program to sum 1 to 100 natural numbers
can u tell me the code for this!
thanks
Printable View
hello,
how can we create a vb 6 program to sum 1 to 100 natural numbers
can u tell me the code for this!
thanks
Well, probably set up a loop, with an accumulator for the total, and then add the numbers that you want to use, and skip the others
Definitely a for loop. Natural numbers are all numbers which are not fractional.
Like this:
For i=1 To 100: sum=sum+1: Next
Surely you have to declare the variables and do some work around like using a form and putting a button on and using a textbox to output the value.
Get your hands on, show what you did and you'll sure get more help here.
Yeah, sorry. Mistyped that.:rolleyes: Well spotted, DataMiser.
For i=1 To 100: sum=sum+i: Next