All pastes #359477 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-16 21:24 UTC
rendered paste body
#include <stdio.h>
/* Various counting programs */
main()
{
    int chr, newl, tab, blank;
    
    /* Settings values to zero */
    newl = 0;
    tab = 0;
    blank = 0;
    
    while ((chr = getchar()) != EOF) {
    if (chr =='\n')
            ++newl;
    if (chr == ' ')
            ++blank;
    if (chr == '\t')
            ++tab;
    
    }
    printf("\nLines = %d\n", newl);
    printf("\nTabs = %d\n", tab);
    printf("\nBlanks = %d\n", blank);
    
    
}