title: C programming scanf() not working correctly
body: <p>I want to know the reason why this code not run properly</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  main()
  {
      char a;
      int n;
      do
      {
          printf("enter the number");
          scanf("%d",&amp;n);
          printf("the squre is %d",n*n);
          printf("want any more so Y for yes N for no");
          scanf("%c%[^\n]",&amp;a);
      }while(a=='Y');
  }
  </code></pre>