Re: Array Element Problems.
Draw two axes, an X axis that represents the index value (i.e. 0,1,2,3 etc) and a Y axis that representsa the corresponding values (i.e. 1,5,9,13 etc.) That makes a straight line f(x) == 1+4*x. The x value is the index and the f(x) value is the value of the array element; subtituting i for x makes:
Code:
for (int i= 0; i < 50; i++)
x[i]=1+4*i;
This is geometric interpretation; you can also solve it algebraically: every element of the array is four more than the elements to its left. The first element equals one; so:
Code:
x[0]= 1;
for (int i= 1; i < 50; i++)
x[i]= x[i-1]+4;
kind regards,
Jos
Re: Array Element Problems.
thank you very much..before this i try something like this x[i] = i =+4 but apparently does not work out..your method however works and thank you again for your guidance..