xref: /csrg-svn/usr.bin/learn/lcount/lcount.c (revision 11254)
1*11254Smckusick #ifndef lint
2*11254Smckusick static char sccsid[] = "@(#)lcount.c	4.1	(Berkeley)	02/24/83";
3*11254Smckusick #endif not lint
4*11254Smckusick 
5*11254Smckusick #include "stdio.h"
6*11254Smckusick 
7*11254Smckusick main()	/* count lines in something */
8*11254Smckusick {
9*11254Smckusick 	register n, c;
10*11254Smckusick 
11*11254Smckusick 	n = 0;
12*11254Smckusick 	while ((c = getchar()) != EOF)
13*11254Smckusick 		if (c == '\n')
14*11254Smckusick 			n++;
15*11254Smckusick 	printf("%d\n", n);
16*11254Smckusick }
17