You need to think more about your code!
1. "rand()" returns a pseudo-random (i.e. any number) between 0 and RAND_MAX (32767). Unless you format the value to 8 digits by zero padding, the output could be any length from 1 to 5 digits.
2. Using mod 99999999 means that you end up with the same value that rand returned, because any value will be less than that, so the modulus (remainder) is always that value.
3. Your while loop is never going to finish, because 'i' can never be 99999999.
To get a pseudo-random value from between two values using rand, you will need to do this:
int value = (double)rand() / (RAND_MAX + 1) * (range_max - range_min)
as given in the example here rand()
In your case, range_max = 99999999 and range_min = 1.
Or, if you want to ensure it is always 8 digits without leading zeros, then range_min = 10000000.