Library Functions

Q1: Do like this fprintf(stdout, "%s %d %f", str, i, a);

A return a random number with a given seed value.

B returns a random number generator with a random value based on time.

C returns a random number.

D returns a random number generator in the specified range.

ANS:C - returns a random number generator with a random value based on time.

The randomize() function initializes the random number generator with a random value based on time. You can try the sample program given below in Turbo-C, it may not work as expected in other compilers.

/* Prints a random number in the range 0 to 99 */

#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(void)
{
    randomize();
    printf("Random number in the 0-99 range: %d\n", random (100));
    return 0;
}



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.