Step-by-step explanation:
rand() function is used to generate random integers between the range 0 to RAND_MAX.So if we divide the the rand() function by RAND_MAX the value returned will be 0.
You cannot do RAND_MAX + 1 the compiler will give error integer overflown.
To generate an integer with a range.You have to do like this:
srand(time(0));
int a=-1*(rand() % (0 - 5245621) +1);
cout <<a;
This piece of code will return an integer within the range 0 to -5245622.