title: Counting blanks, tabs and new line
body: <p>I am new to C language, can someone help in identifying what am I doing wrong in implementing a program to count blanks, tabs, and newlines.</p>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  //Write a program to count blanks, tabs, and newlines.
  int main(){
      char str[100];
      printf("Enter the text");
      scanf("%s",&amp;str);
      int space=0;
      int tabs=0;
      int newLine=0;
      int i=0;
      while(str[i]!='\0'){
          if (str[i] == ' ')
              space++;
          if (str[i] == '\t')
              tabs++;
          if (str[i] == '\n')
              newLine++;
          i++;
  
      }
  
      printf("space:%d\ntabs:%d\nnew line:%d",space,tabs,newLine);
      return 0;
  }
  </code></pre>