Question: // INSTRUCTIONS: p4-whileLoop p4-while Loop Numbers: Sum: Average: Min: Max: Type your name here

// INSTRUCTIONS:

// Turn on error reporting.

error_reporting(E_ALL);

ini_set('display_errors', '1');

// Randomly generated count.

$count = rand(1, 30);

$year = 2021;

$sum = 0;

$ave = 0.0;

$min = 0;

$max = 0;

$numbers = "";

//while construct

// #1 -- Write a while statement that generates $count random numbers in the closed range [-50, 50].

//To generate a random number in a range use the rand() function as in $count = rand(-50, 50);.

//Each time the body of the while executes, perform the following computations in the listed order:

//build the $numbers string so it contains each randomly generated number. Each number should have a leading space, e.g. 4 -50 4.

//Add the random number to the running sum.

//Check if the random number is the smallest thus far and update $min if need be.

//Check if the random number is the largest thus far and update $max if need be.

//TYPE YOUR CODE HERE

// #2 -- After the while loop finishes, compute the average and update $ave.

//TYPE YOUR CODE HERE

?>

p4-whileLoop

p4-while Loop

© Type your name here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!