I observed that rand() library function when it is called just once within a loop, it almost always produces positive numbers.
rand()
for (i = 0; i <
To avoid 0, try this:
int rnumb = rand()%(INT_MAX-1)+1;
You need to include limits.h.
limits.h