Hi, im having some problem while doing my assignment,

i cant make my recursive function to loop as to get each digit from the number generated randomly.

```
int random (int num)
{
srand (time (NULL));
num = rand();
cout << num << endl;
if (num != 0)
return num % 10;
num = num / 10;
}
```

Wat im trying to do here is to get each digit from the number, for example, number show is 3859, i should get the result of 9 5 8 3.

But from my coding i'll only get the last digit, that's 9.

Thanks