Hi,
Trying out how to increment a integer by accumulations of 2. I know as a single integer the code would involve '2++' etc but the sum i need to do is for eg. 2*2*4*4*6*6*8*8 etc.
Thanks...
Printable View
Hi,
Trying out how to increment a integer by accumulations of 2. I know as a single integer the code would involve '2++' etc but the sum i need to do is for eg. 2*2*4*4*6*6*8*8 etc.
Thanks...
While I don't entirely follow, the following are used to increment/decrement values :
2+=2 //result 4
2-=2 //result 0
2*=3 //result 6
2/=2 //result 1
Does this help you?
Code:int ans = 1;
for (int i = 2; i <= 10; i++2)
{
ans = ans * i * i;
}
thanks alot it works fine now
old andrew