title: How scanf works if I add a new line '\n' at the end
body: <pre><code>#include &lt;stdio.h&gt;
  int main(){
  
      int a,b,c;
  
      scanf("%d%d%d\n",&amp;a,&amp;b,&amp;c);
      printf("%d %d %d",a,b,c);
  
      return 0;
  }
  </code></pre>
  
  <p>Look I am taking 3 inputs and printing 3 outputs... But as I added a new line at the end of the scanf function I have to give 4 inputs to get 3 outputs(I get the first 3 I give as input)... How scanf works here? 
  And in this case:</p>
  
  <pre><code>#include &lt;stdio.h&gt;  
  
  int main(){ 
  
      double n[2][5]; int i,j; 
  
      for (i=0;i&lt;=1;i++){ 
  
          for(j=0;j&lt;=4;j++){ 
  
              scanf("%lf\n",&amp;n[i][j]); 
              printf("Class=%d Roll=%d Marks=%lf\n",i+6,j+1,n[i][j]); 
  
          } 
      }
  
      return 0; 
  }
  </code></pre>
  
  <p>Look I have to give 11 inputs to get the 10 outputs... And each time I give a input I get the previous input as an output... How scanf is working here? </p>