Home >>c programs >C Program to generate random numbers within a range

C Program to generate random numbers within a range

C Program to generate random numbers within a range

In this example, we will see a C program to generate random numbers within a given range.

We will use the rand() function in this program. The rand() function in the C language is used to generate a random number. Its return type is an integer.

Program:

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Random number is:  %d ", rand());
return 0;
}

Output:
Random number is: 1804289383

No Sidebar ads