Examveda

Predict the output of the following code.
#include <stdlib.h> 
int main() 
{ 
     srand(0); 
     printf("%d\n", rand()%50); 
     return 0; 
}

A. compilation error

B. random number between 0 to 50 (both inclusive)

C. random number between 0 to 51 (both inclusive)

D. random number between 0 to 49 (both inclusive)

Answer: Option D


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures