title: Why is the character value skipped by scanf in c while reading user input?
body: <pre><code>int main(int argc, char const *argv[])
  {
      int t, n, i, count;
      char curr;
      long long int total;
      scanf("%d", &amp;t);
      while(t--){
          count = 0;
          total = 0;
          scanf("%d", &amp;n);
          for(i=0;i&lt;n;i++){
              scanf("%c", &amp;curr);
              if(curr == '1'){
                  ++count;
              }
          }
          if(count == 1){
              printf("1\n");
          }
          else{
              total = count + (count * (count-1))/2;
              printf("%lld  %d\n",total, count);
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>When i enter the input in the following format,</p>
  
  <pre><code>1
  4
  1111
  </code></pre>
  
  <p>I'm expecting output as: <code>10 4</code><br>
  But what i get is : <code>6 3</code>.</p>
  
  <p>The Program is logically &amp; syntatically correct and i'm just unaware of what actually went wrong here. Help will be appreciated. </p>