To generate a random number in C you can use the snippet below.
Sample C
#include <time.h> #include <stdlib.h> srand(time(NULL)); int r = rand();
To generate a random number in C you can use the snippet below.
#include <time.h> #include <stdlib.h> srand(time(NULL)); int r = rand();
To generate a random number in C you can use the following snippet.
srand(time(NULL)); int r = rand() % 10; //generates a random number between 0 and 9 printf("%d",r);