title: For C: Why does my Matrix output have the incorrect formatting? (Beginner)
body: <p>My inputs repeat themselves rather then starting from blank and letting me input the next integer. An additional issue is that I am unable to print the matrix like &quot;100 200&quot; and then &quot;300 400&quot; on the next line. I have tried messing with the newlines and taking out the scan function but nothing seems to work.</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  int rows;
  int colums;
  int i;
  int j;
  
  int main() {
      int mat[100][100];
      printf(&quot;Please enter the number of rows: &quot;);
      scanf(&quot;%d&quot;,&amp;rows);
      printf(&quot;Please enter the number of columns: &quot;);
      scanf(&quot;%d&quot;,&amp;colums);
      printf(&quot;Enter Matrix A\n&quot;);
      for(int i = 0; i &lt; rows; ++i){
          for(int j = 0; j &lt; colums; ++j) {
              scanf(&quot;%d&quot;, &amp;mat[i][j]);
              printf(&quot;%d&quot;,mat[i][j]);
          }
      }
      printf(&quot;Enter Matrix B\n&quot;);
      int matb[100][100];
      for(int i = 0; i &lt; rows; ++i){
          for(int j = 0; j &lt; colums; ++j) {
              scanf(&quot;%d&quot;, &amp;matb[i][j]);
              printf(&quot;%d&quot;,matb[i][j]);
          
          }
      }
      printf(&quot;A+B =\n&quot;);
      for(int i = 0; i &lt; rows; ++i){
          for(int j = 0; j &lt; colums; ++j){
              int new;
              new = mat[i][j]+matb[i][j];
              printf(&quot;%d&quot;,new);
          }
      }
  }
  </code></pre>