how to generate random long int in c where every digit is non-zero? morever the random numbers are reapeting : I am making a library management in c for practice. Now, in studentEntry I need to generate a long int studentID in which every number is non-zero.So, I am using this function.

     long int generateStudentID(){
    	 srand(time(NULL));     
    	 long int n = 0;
     	 do
         {
             n = rand() % 10;
         }while(n == 0);
    	 int i;     
    	 for(i = 1; i < 10; i++)
         {
             n *= 10; 
             n += rand() % 10;
         }
        if(n < 0)
    	n = n * (-1); //StudentID will be positive
        return n;
    }

**

 - output
<pre>
Name : khushit
phone No. : 987546321
active : 1
login : 0
StudentID : 2038393052
Wanted to add another student?(y/n)
</pre>

**
I wanted to remove all zeros from it.