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

Join The Discussion