1. ## Nested Loop with add-on Equation..?? Seems Impossible!

I'm able to do all the things required in my assignmen...except this problem.....

I've the following equation (a very simple equation):
Code:
`AOA = (ACC[j] + ACC[i])/2      (1st round of looping)`
In the first round of looping, ACC[j] are added to ACC[i] and find thier average...but in 2nd round of looping...
Code:
`AOA = [(ACC[j] + ACC[i])/2 + (ACC[j] + ACC[i])/2]/2 (2nd round of looping)`
Next...in the 3rd round of looping....
Code:
`AOA = [(ACC[j] + ACC[i])/2 + (ACC[j] + ACC[i])/2 + (ACC[j] + ACC[i])/2]/3      (3rd round of looping)`
These goes on and on until "n" round of looping......

In order for u people to get better understanding of my intention, my codes are below:
Code:
```i=0;
for (i=0; i<Columns-1; i++){
for (j=0; j<Columns-1; j++){

if (Selected[i] == 1 && UnSelected[i] == 0){  //i:Selected   j:Candidate feature (unselected)
if (Selected[j] == 0 && UnSelected[j] == 1){  //[j], the ACC must be from unselected feature ==> "Selected[j] ==0"
AOA = (ACC[j] + ACC[i])/2;    // This is WRONG.....What should this be to make it flexible??
P_Plus_A[j] = 0.1 * P[j] + 0.9 * AOA;

}//End If
}//End If
}//End For
}//End For

//After calculation, calculated lowest value are selected...
//Next round of looping starts with add-on of equation```
So my question is: How to keep adding the equation on and on...??

_____

2. Just use the loop variables to multiplie and divide by. Factor out (ACC[j] + ACC[i]) and you'll get:

(ACC[j] + ACC[i]) * [1/2 + 1/2] / 2; // second loop

(ACC[j] + ACC[i]) * [1/2 + 1/2 + 1/2] / 3; // third loop

Every loop iteration, you get (ACC[j] + ACC[i]) * 1/2 if you simplify the above equations. I'm not sure if that's what you are expecting, but that's what you're doing. If you want to keep a running total of the averages, you can just do something like:

AOA += average;

I'm not entirely sure what you're trying to accomplish

3. (ACC[j] + ACC[i]) * [1/2 + 1/2] / 2; // second loop

(ACC[j] + ACC[i]) * [1/2 + 1/2 + 1/2] / 3; // third loop
How do you get that...??

_____

4. Originally Posted by AssistMe
How do you get that...??

_____
Math

(ACC[j] + ACC[i]) is a common term... Your equations simplify to (ACC[j] + ACC[i])/2 for every loop iteration. So, that's why I don't know if that's what you're trying to do or if you know exactly what you are doing..