Which of the following statements generates a random number between 0 and 50?

Which of the following statements generates a random number
between 0 and 50? Choices; a. srand(time(0)); number = rand() % 50; B srand(time(0)); num = rand()50; vs. srand(time(10)); number = rand() % 50; D. srand(time(10)); num = ran()/50;

Answer 1

a. srand(time(0));
num=rand()%50;

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *