Program to display array elements in the ascending order of number of factors each element has
int main(void) {
    int n,a[2][25],i,j;
    printf("Enter the no. of items\n");
    scanf("%d",&amp;n);
    printf("Enter the items\n");
    for(j=0; j&lt;n; j++)
    {
        scanf("%d",&amp;a[0][j]);
    }
    for(j=0; j&lt;n; j++)
    {
        a[1][j] = facts(a[i][j]);         // here i is not set yet
    }


Your compiler should've warned you about this. Please make sure all variables have a set value before checking them.

The only reasons this works is because your compiler decided to initialize i at zero here. However, it is not required to do so by the specification. This means it will break on other systems.