Vidyalelo
Computer Science · Q374

Object Oriented Programming Using C++

Engineering and GATE · Computer Science · question 374

Q374

Which of the following formulas can be used to generate random integers between 1 and 10?

A.
1 + rand() % (10 - 1 + 1)
Answer
B.
1 + (10 - 1 + 1) % rand()
C.
10 + rand() % (10 - 1 + 1)
D.
10 + rand() % (10 + 1)

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board