12-14-2011, 11:22 AM
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
The array should contain the sequence.
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.