// This is the code its part of my college assignment
#include <stdio.h>
#include <stdlib.h>// header file for rand and srand function
#include <time.h>
int main()
{
srand(time(0)); // time is used for different values
int result = rand() % 1112 + 1000; // 1112 is max value & 1000 is min value. Also This formula worked in range between (-999 to 999)
printf("%d", result);
return 0;
}
Output:
1702
1810 and so on...
I noticed this during my college assignment...