'running the program doesn't print the second printf statement

whenever I run the program the second print statement isn't printing. I tried using a function but I'm new to C and don't really understand anything. I've also attached my activity as I'm not sure how to do the other things on it.activity photo

#include <stdio.h>
#include <string.h>

#define LINE_LENGTH 1000

int main(int argc, char **argv)
{   
    FILE *input_file = fopen("cstest.c", "r");
    char line [LINE_LENGTH];
    
    //while loop to ger
    while (fgets(line, LINE_LENGTH, input_file) != NULL)
    {   
        int ch = 0;//ch is the cast
        int lines = 0;//start with one because 
        if (input_file == NULL) 
            return 0;
    
        while (!feof(input_file))
        {
            ch = fgetc(input_file);
            if (ch == '\n')
            {
                lines++;
            }
        }//end while
    
        printf("lines: %d\n", lines);

    }//end while loop

    while (fgets(line, LINE_LENGTH, input_file) != NULL)
    {   
        int ch = 0;//ch is the cast
        int lines = 0;//start with one because 
        if (input_file == NULL) 
            return 0;

        while (!feof(input_file))
        {
            int characters = 0; 
            char c;
    
            for (c = getc(input_file); c != EOF; c = getc(input_file))
                // Increment count for this character
                characters = characters + 1;
    
            printf("characters: %d\n", characters);

            fclose(input_file);
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source