Write a program to investigate a set of 15 random numbers. Declare variables. Se
ID: 3842504 • Letter: W
Question
Write a program to investigate a set of 15 random numbers. Declare variables. Seed the random number generator with the time of day. Initialize the variables for maximum, minimum, and count. On each pass through a for loop: Generate a random integer between -50 and 50 and print it. See notes on random numbers under files in Canvas. Check to see if it is larger than the maximum. If so assign as new maximum. Check to see if it is smaller than the minimum. If so, assign as new minimum. Check to see if it is negative. If so add to the count of negatives. Upon exiting, print maximum, minimum, and count of negative numbers.Explanation / Answer
static void Main() { DateTime currentTime = DateTime.Now; int maxValue = 100; int hour = currentTime.Hour; int minute = currentTime.Minute; int second = currentTime.Second; int milisecond = currentTime.Millisecond; int randNum = (((hour + 1) * (minute + 1) * (second + 1) * milisecond) % maxValue); Console.WriteLine(randNum); Console.ReadLine(); } ------------------------------- #include #include #include int main() int n, max, num, c; printf("Enter the number of random numbers you want "); scanf("%d", &n); printf("Enter the maximum value of random number "); scanf("%d", &max); printf("%d random numbers from 0 to %d are :- ", n, max); randomize(); for (c = 1; cRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.