Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find 1 4 10 22
#1
Not Solved
how to find the these numbers by using vb scripting(by using for loop)

pls answer me



Thanks
vasu.SmileSmileSmile
Reply
#2
Not Solved
where do you want to find these numbers from?
1)From a group of numbers?
2)From string?

Can you please elaborate?
Reply
#3
Not Solved
Hi Vasu,

If i have correctly understood the sequence, it is in the form of n=n*2+2, n starting from 1. The following code will yield this sequence

Code:
Dim arr(10) //Declare an array which will contain the sequence numbers
totNum=4 // Total number in the sequence (here 4 since seq is 1 4 10 22)
arr(0) = 1 //Assign the first place with value 1

For counter=1 To totNum
    arr(counter) = arr(counter-1)*2+2
Next

The array should contain the sequence.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)