sorting in array,
i'm stuck understand that why we've used a 'j' loop here ?
can anybody explain ? and why we are checking this condition ? if(num[i]>num[j])
int main(void)
{
int num[5],temp;
int i,j;
for(i=0;i<5;i++)
{
printf("Enter Value for %d",i);
scanf("%d",&num[i]);
}
for(i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
if(num[i]>num[j])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
}
for(i=0;i<5;i++)
{
printf("%d ",num[i]);
}
getche ();
}