Which of the following C+ + statements displays a random number in the range 1 through 10?
a)
cout << 1 + rand () % 10;
b)
cout << 1 + rand () % (10 - 1 + 1);
c)
cout << 1 + rand () % 10 - 1 + 1;
d)
first and second answers are correct
e)
all of the above
+2
Answers (1)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following C+ + statements displays a random number in the range 1 through 10? a) cout ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Home » Computers & Technology » Which of the following C+ + statements displays a random number in the range 1 through 10? a) cout << 1 + rand () % 10; b) cout << 1 + rand () % (10 - 1 + 1); c) cout << 1 + rand () % 10 - 1 + 1;