1
answer
0
watching
80
views
28 Nov 2020
int myRandomNumber;
srand(time(NULL)); // seed the random number generator
myRandomNumber = rand(); // each time you call this function there will be a different random number.
Generate a random number, and output it. Use if statements to determine if the number is odd or even, and output a message to that effect. Similarly, output if the number is divisible by 3, and if it is divisible by 10. Use the % operator to achieve this. Run the program, and print the results several times using different numbers to be sure that it’s working.
int myRandomNumber;
srand(time(NULL)); // seed the random number generator
myRandomNumber = rand(); // each time you call this function there will be a different random number.
Generate a random number, and output it. Use if statements to determine if the number is odd or even, and output a message to that effect. Similarly, output if the number is divisible by 3, and if it is divisible by 10. Use the % operator to achieve this. Run the program, and print the results several times using different numbers to be sure that it’s working.
Karol A.Lv10
8 Mar 2021