Respuesta :

Answer:

srand(time(NULL));

int namesrand = rand() % 100 +1;

Explanation:

srand() is the function which is used for seeding the rand() function.

it defines the starting point different in whenever rand() function executes. Therefore, rand() generate the output different in every execution.

rand() is the function that generates the random number within the range.

for example;

rand() % 20

it generates the random number within the range [0,20).

NOTE: 20 not included in the range and zero is included.

similarly, generate the number between 0 to 99.

rand() % 100.

so, if we add the generated number by one then it ranges become 1 to 100 both included.

 

ACCESS MORE