Q:

"Process terminated with status -1073741510 (0 minute(s), 6 second(s))"

First printf is working, but I got that problem in the function:
"Process terminated with status -1073741510 (0 minute(s), 6 second(s))"

I just have a number of digits and want to calculate the number of pages that can be numbered with that number
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "book.h"

int main()
{
    long no_pages, no_digits;

    srand(time(0));
    no_digits=(rand()% 10000000)+10000;
    printf("The number of digits are %ld", no_digits);

    no_pages = no_of_pages(no_digits);
    printf ("\n The number of pages are %ld", no_pages);
}

This is the function that calculates number of pages
int no_of_pages(long no_digits)
{

    long no_pages=0,no_digits_page;

    while(no_digits>0)
    {
        no_pages++; // count number of pages
        long  aux=no_pages;
        long no_digits_pages=0; // conut how many digits are on a page

        while(aux)
        {
            aux=aux/10;
            no_digits_page++;
        }
        if(no_digits_page == 1)
            no_digits--;
        else
            if(no_digits_page == 2)
                no_digits=no_digits-2;
        else
            if(no_digits_page == 3)
                no_digits=no_digits-3;
        else
            if(no_digits_page == 4)
                no_digits=no_digits-4;
        else
            if(no_digits_pages == 5)
                no_digits=no_digits-5;
        else
            if(no_digits_page == 6)
                no_digits=no_digits-6;
        else
            if(no_digits_page == 7)
                no_digits=no_digits-7;
        else
            if(no_digits_page == 8)
                no_digits=no_digits-8;
        else
            if(no_digits_page == 9)
                no_digits=no_digits-9;

    }
    if (no_digits<0)
    {
        return no_pages-1;
    }
    else
        return no_pages;
}

A:

in no_of_page 

the variable no_digits_page is not initialized, the behavior is undefined
there are a lot of possibilities where you do not modify no_digit and loop without end

Note also the function can be easily simplified replacing

 if(no_digits_page == 1)
       no_digits--;
   else
      if(no_digits_page == 2)
           no_digits=no_digits-2;
   else
       if(no_digits_page == 3)
           no_digits=no_digits-3;
   else
       if(no_digits_page == 4)
           no_digits=no_digits-4;
   else
       if(no_digits_pages == 5)
           no_digits=no_digits-5;
   else
       if(no_digits_page == 6)
           no_digits=no_digits-6;
   else
       if(no_digits_page == 7)
           no_digits=no_digits-7;
   else
       if(no_digits_page == 8)
           no_digits=no_digits-8;
   else
       if(no_digits_page == 9)
           no_digits=no_digits-9;

by
    if ((no_digits_page >= 1) && (no_digits_page <= 9))
       no_digits -= no_digits_page;

Probably you confuse no_digits_page and no_digits_pages, if I remove one of them also using my simplified version :
int main()
{
  long no_pages, no_digits;

  srand(time(0));
  no_digits=(rand()% 10000000)+10000;
  printf("The number of digits are %ld", no_digits);

  no_pages = no_of_pages(no_digits);
  printf ("\n The number of pages are %ld\n", no_pages);
}

int no_of_pages(long no_digits)
{
  long no_pages=0;

  while(no_digits>0)
  {
    no_pages++; // count number of pages
    long  aux=no_pages;
    long no_digits_page=0; // conut how many digits are on a page

    while(aux)
    {
      aux=aux/10;
      no_digits_page++;
    }
    if ((no_digits_page >= 1) && (no_digits_page <= 9))
      no_digits -= no_digits_page;

  }
  if (no_digits<0)
  {
    return no_pages-1;
  }
  else
    return no_pages;
}

Compilation and execution (declaring no_of_pages in book.h) :
pi@raspberrypi:/tmp $ gcc -pedantic -Wextra -Wall a.c
pi@raspberrypi:/tmp $ ./a.out
The number of digits are 2211616
 The number of pages are 387120

The program finishes, but don't know if it computes the expected result

