Advertisement
Unnnamedddd

Untitled

Jan 17th, 2021
1,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. main()
  4. {
  5.     int c;
  6.     int nSpaces, nTabs, nNewLines;
  7.     while ((c = getchar()) != EOF)
  8.     {
  9.         if (c == ' ')
  10.             ++nSpaces;
  11.         else
  12.             if (c == '\t')
  13.             ++nTabs;
  14.             else
  15.                 if (c == '\n')
  16.                 ++nNewLines;
  17.     }
  18.     printf("nSpaces = %d\nnTabs = %d\nnNewLines = %d\n", nSpaces, nTabs, nNewLines);
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement