ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#include <iostream>
#include <ctime>
#include <cstdlib>
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;
    }
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.