I have a more complicated program I'm wishing to have display the output, however, to save some time I'm using an example of a shorter version. Please help count the lines in input and display the output in terminal when ./program is executed after compilation.Code:#include <stdio.h> main() { int c, n1; n1 = 0; while ((c = getchar()) != EOF) if (c == '\n') ++n1; printf("%d\n", n1); }
To help count and compute lines, words and within arrays.
Thanks,
yoda