/* Purpose : To find the minimum and maximum of 100 random numbers generated.*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int minimum; //variable to store the maximum of the generated
random numbers.
int maximum; //variable to store the minimum of the generated
random numbers.
int number; // variable to store every number generated by the rand
function.
int i; //variable to keep iteration count.
int initNum; //variable to store the first number generated by the
rand function.
initNum = rand(); //generate the first random number.
printf("\nNumber 1 = %d", initNum); // Print the first random
number generated.
minimum = initNum; // initNum is assumed to be both the minimum and
maximum to begin with.
maximum = initNum; // initNum is assumed to be both the minimum and
maximum to begin with.
for(i = 2;i<=100;i++) { //starting the iteration from 2 as
already 1 number is read.
number = rand(); //generation of random numbers using rand
function.
sleep(1); // delays the generation by 1 second for user to
observe
printf("\nNumber %d = %d",i, number); // prints the numbers
generated by the rand function
if(maximum < number) //logic to find max, checks with the next
number to see if
maximum = number; //current max is less than the next generated
number, if so swap
if(minimum > number) //logic to find min, checks with the next
number to see if
minimum = number; //current min is more than the next generated
number, if so swap
}
printf("\n Minimum = %d", minimum); // print the minimum
printf("\n Maximum = %d", maximum); // print the maximum
return 0;
}
Use VI and post output screen Use a For Loop to generate 100 random numbers. Determine...
TRY IT 1.11 You are going to use the random number generator to generate different types of samples from the data. This table displays six sets of quiz scores (each quiz counts 10 points for an elementary statistics class #1 #2 #3 34 #5 #6 5 7 10 9 8 10 5 9 8 7 6 9 10 8 6 7 9 9 10 10 9 8 9 7 8 9 5 7 4 9 9 9 10 8 7...
Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...
The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use the following libraries: #include <math.h> #include <stdlib.h> #include <string.h> #include <limits.h> and any .graphics and .timers libraries. The guidelines are outlined as follows: Terminal Set-up: you may assume that the terminal will be quite large, for example, on the order of 150×50, or more. Status Display: The...