I'm using a C++ compiler, but I'm writing C code (if that helps)
There is a string of numbers.
(-1^(a-1)/2a-1)B^(2a-1)
A and X are user-specified...
A must be positive, although X might be positive or negative...
in order to decipher this sequence...
I need to utilise exponents/powers, but I have some constraints...
I can't create a new function, utilise recursion, or use pow() (among other advanced math functions that come with cmath or math.h).
There were other comparable queries, however many solutions employed functions and recursion that were not immediately related to this subject.
This is the code that works fine with pow(); I spent a lot of time attempting to adapt it to replace pow() with my own code, but nothing appears to be working... I'm mostly getting incorrect results.
X and J are variables that have been entered by the user.
for (int i = 1; i < j; i++)
sum += (pow(-1, i - 1)) / (5 * i - 1) * (pow(x, 5 * i - 1));
}