Circles intersecting,comparing arrays Visual Studio

I've got a task to find which circle intersects with the most other circles.

I have the x-coordinates, y-coordinates, and the radii of many different circles. I've put x-coordinates into array X[], y-coordinates into Y[] and radius into R[]. I've also found the way to check if one circle intersects with another, shown below.

I know that two FOR loops should be used,but I can't seem to find the way,so that the loop compares one element to all other elements in the array,then compares another element to all other elements and etc. Maybe someone knows the way?

int max = 0;
for (int i = 0; i < n; i++)
{
int times_condition_met = 0;
for (int j = 0; j < n; j++)
{
if ( (Distance(X, Y, i) < (Radius[i] + Radius[i + 1])) == true ) // Checking a condition/making a comparison.
{
times_condition_met++; // Increment the number of times the condition is met.
}

if (times_condition_met > max)
{

}

}

}
To check if the circle i intersects with circle i+1, my if evaluates:

if (Distance (n, X, Y,i ) < (Radius[i] + Radius[i+1])) // i is the index of the element

I wanna find a way to see f.e. : (the index of circle) intersects with (amount of circles it intersects with)

And how to indentify which circle intersects how many times?
Topic archived. No new replies allowed.