That would print the correct value for min_x, but (1) it would have completely meaningless values for i and j, not the values where the minimum/s is/are, and (2) it would print once for every day, not JUST the days where the minimum was met.
That would print the correct value for min_x, but (1) it would have completely meaningless values for i and j, not the values where the minimum/s is/are, and (2) it would print once for every day, not JUST the days where the minimum was met.
Last edited by tabstop; 11-09-2008 at 11:53 PM. Reason: accuracy
so when power[i][j]==min_x i need to print i and j, now how do i do that in a for loop?
Just like you have it -- if power[i][j]==min_x, print i and j.
ohhhh got it i believe, so
[code]for(i=0; i <NROWS; i++)
for(j=0; j<NCOLS; j++)
if(power[i][j] == min_x)
printf("Week: %d Day: %d \n", i+1, j+1);
ohhhh got it i believe, so
[code]for(i=0; i <NROWS; i++)
for(j=0; j<NCOLS; j++)
if(power[i][j] == min_x)
printf("Week: %d Day: %d \n", i+1, j+1);[\code]