title: C finding maximum number in a row of 2D array and replacing it with elements in the upper triangle
body: <p>Basically i want to create a 2 dimensional array size NxN, find the maximum value in each row and replace it in the upper triangle or rather replace the elements with the maximum it for that specific row, but above the diagonal.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #define MAXIMUM 100
  
  int main()
  {
       int n, i, j, temp,m;
      float a[MAXIMUM][MAXIMUM], max;
      printf("dimensions: ");
      scanf("%d",&amp;n);
      printf("input elements\n");
      for (i=0; i&lt;n; i++){
          for (j=0; j&lt;n; j++){
              scanf("%f",&amp;a[i][j]);
          }
      }
  
      max=a[0][0];
      for (i=0; i&lt;n; i++){
          for (j=0; j&lt;n; j++)
              {
                  if(max&lt;a[i][j]){
                      max=a[i][j];
                  }
  
              for(m=0;m&lt;n;m++) //the problem starts here
                  {
                      if(max&gt;a[i][m]){
                          if(i+m&gt;n-1){
                          a[i][m]=max;
                          }
  
                      }
                  }
              }
          }
  
              for(i = 0; i &lt; n; i++) {
                  printf("\n");
                      for(j = 0; j &lt; n; j++) {
                              printf("%f ", a[i][j]);
                          }
          }
      return 0;
  }
  </code></pre>