Final answer:
To generate two random integers between 100 and 149 using the rand() function in C, you use the formula (rand() % 50) + 100 twice after seeding the random number generator. For reproducible results, use a fixed seed value, but for unique random numbers on each program run, use srand(time(NULL)).
Step-by-step explanation:
To print two random integers between 100 and 149, you can use the rand() function in C. The rand() function returns a pseudo-random integer, which needs to be scaled and shifted to fit the desired range. To ensure that the numbers fall between 100 and 149 inclusive, you would use the following formula inside your main function: (rand() % 50) + 100. This formula works by generating a random number between 0 and 49 and then adding 100 to shift it into the range 100-149. To print two separate random numbers, you would call this code twice, remembering to seed the random number generator with a value for reproducibility.
An example program snippet would look like:
printf("%d\\", (rand() % 50) + 100);
printf("%d\\", (rand() % 50) + 100);
Note that if you want non-reproducible random numbers each time the program is run, you should seed the generator with a value that changes, such as the current time using srand(time(NULL)) instead of a fixed seed value. However, the example given has a fixed seed for predictable outputs.