Can somebody tell me the code for:
a-(a^3(power of 3)/a)+a^5/a-a^7/7........n
The code has to contain only for, if, while and other basic statements....please help me!
Can somebody tell me the code for:
a-(a^3(power of 3)/a)+a^5/a-a^7/7........n
The code has to contain only for, if, while and other basic statements....please help me!
For calculating the sum try something like this:
1+2+3 + ... + i + ..
int sum = 0;
for (int i=1;i<N;i++) {
sum = sum + i;
}
Also there is this method: Math.pow(a,b)
.
Calculates the power:
Math(2,3) = 2^3 = 8
Now let's see some code