Home » C++ Programming » Numbers » Question
  1. What is the output of this program?
    #include <cstdlib>
    #include <iostream>
    using namespace std;
    int main()
    {
    int Ran = rand();
    cout << Ran << endl;
    }
    1. 9383
    2. 18042
    3. 1804289383
    4. 0​ to RAND_MAX
    5. None of these
Correct Option: D

As the declared number is integer, It will produce the random number from 0​ to RAND_MAX. The value of RAND_MAX is library-dependent, but is guaranteed to be at least 32767 on any standard library implementation.



Your comments will be displayed only after manual approval.