#include <string.h> #include <stdio.h> #define MAX_LINE_LENGTH char linebuffer[MAX_LINE_LENGTH]; int main() { int lines=0; while (fgets(linebuffer,sizeof(linebuffer),stdin)!=0) { ++lines; } printf("%d\n",lines); return 0; }