This is a program from the book "C The Programming Language".
it is supposed to take an input and count the number of lines.
#include <stdio.h>
int main(void)
{
long c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d\n", nl);
}
When I run the program and provide an input it keeps adding newline after hitting Enter.