How do I write a code for avoiding bad scheduling of a meeting at the same time using matrix? Pls help!!

void AvoidBadSchedule (int A[][cols])
{
int i,j, l1=0,l2=0,l3=0, p1,p2,p3;

for (i=0;i<cols+1;i++)
{
    for(j=i+1;j<cols;j++)
    {
        if(A[i][j]>l1)
        {
            l1 = A[i][j];
            p1=j+1;
        }
    }
}
 for (i=1;i<cols-1;i++)
{
    for(j=i+1;j<cols;j++)
    {
         if(A[i][j]>l2 || A[i][j] != l1 )
        {
            l2 = A[i][j];
            p2=j+1;
        }
    }
}
for (i=0;i<cols-1;i++)
{
    for(j=i+1;j<cols;j++)
    {
         if( A[i][j] >= 0 || A[i][j] <l1 && A[i][j] <l2)
        {
            l3 = A[i][j];
            p3=j+1;
        }
    }
}

//Output of the bad schedules

printf(“The following presentations are not to be scheduled at the same time\n”);
l1>1? printf(“Presentation -->%d\n”,p1): printf("");
l2>1? printf(“Presentation -->%d\n”,p2):printf("");
l3>1? printf(“Presentation -->%d\n”,p3):printf("");

}