Home » C++ Programming » Numbers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    int main ()
    {
    srand (time(NULL));
    printf ("Random number is: %d\n", rand() % 50);
    srand (1);
    return 0;
    }
    1. 34
    2. Compilation Error
    3. 50
    4. Any number from 0 to 49
    5. None of these
Correct Option: A

This program will create a random number based on time function using srand function.



Your comments will be displayed only after manual approval.