Hi every one
can anybody solve this problem for me.
What initial values of a and c are required such that the final values of a and b are:
a = 32
b = 4
…
int a,b,c
a = ?
b = 0
c = ?
for( b=0; a<12; b++ )
{
a = (a+a) * c;
}
…
Thank you
Deven
Hi,
First of all this is not an Oracle query. But let me answer this for you in good spirit.
Since the final value of b is 4 , there will be 5 iterations
Iteration 1 : a = 2ac
Iteration 2: a = 4 ac^2
Iteration 3 : a = 16 ac^3
Iteration 4 : a = 256 ac^4
Iteration 5 : a = 65536 ac^5
Now assuming that this will be the exit condition you have two equations and two unknowns now:
65536 ac^5 = 32
256 ac^4 < 12
Lets put this in this form:
ac^5 = 1/2048
ac^4 < 3/64
These two equations will give you infinite number of solutions. You can choose any of those answers. For example a = 1/64 and c = 1/2 is one answer and also a = 1/2 and c = 1/4 is another solution..