You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
326 B
C
14 lines
326 B
C
#include <time.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
int num;
|
|
/* Seed number for rand() */
|
|
srand((unsigned int) time(0) + getpid());
|
|
printf("\nGenerating a random number using srand and rand function.\n");
|
|
num = rand();
|
|
printf("%d\n", num);
|
|
return EXIT_SUCCESS;
|
|
} |