Vidyalelo
C++ Programming · Q536

C++ miscellaneous

Programming · C++ Programming · question 536

Q536

What will be the output of the following C++ code? #include #include #include using namespace std; int main() srand((unsigned)time(0)); int ran; int low = 1, high = 10; int range = (high - low) + 1; for(int index = 0; index < 1; index++) ran = low + int(range * rand() / (RAND_MAX + 1.0)); cout << ran << endl;

A.
1
Answer
B.
2
C.
3
D.
4

Answer: Option A

Solution

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