Home

Published

- 1 min read

random number in c

img of random number in c

The solution for this is noted below

random number in c

Solution

   #include <stdio.h>
#include <stdlib.h>
#include <time.h>

    #define randnum(min, max) \
        ((rand() % (int)(((max) + 1) - (min))) + (min))

int main()
{
    srand(time(NULL));

    printf("%d\n", randnum(1, 70));
}

Try other methods by searching on the site. That is if this doesn’t work