for (i=0;i<n;i++){ max=b[i][0]; min=b[i][0]; for (j=1;j<m;j++){ if (min>b[i][j]){ min=b[i][j]; admin=j; } if (max<b[i][j]){ max=b[i][j]; admax=j; } } printf ("\nΠ %d ΡΡΡΠΎΠΊΠ΅ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΡΠ°Π²Π΅Π½ %.2f, ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ %.2f", i, max, min); } The task is to find the maximum and minimum values ββand swap them. The whole cycle works and the code works fine, but if inside for(i=0;i<nn;i++){...} after printf add
b[i][admax]=min; b[i][admin]=max; That as soon as it reaches this line - the work of the cycle and the program in general ends
Π 0 ΡΡΡΠΎΠΊΠ΅ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΡΠ°Π²Π΅Π½ 4,00, ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ 1,00
admin(respectively,admax)? I do not see the initialization of these variables, so that there in them is unknown. I would recommend to rewritemax=b[i][0]; min=b[i][0];max=b[i][0]; min=b[i][0];asmax=b[i][admax=0]; min=b[i][admin=0];max=b[i][admax=0]; min=b[i][admin=0];- Harry