summaryrefslogblamecommitdiff
path: root/line_counter.c
blob: 0447aa71b79023d6a167bd0f586be9618c23a02e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                  
#include<stdio.h>

/*
 * Count lines in input
 */
main() {
    int c, nl;

    nl = 0;

    while ((c = getchar()) != EOF)
        if (c == '\n')
            ++nl;

    printf("%d\n", nl);
}