Flowchart for the greatest of five numbers
Answers
Answer:
this is the way you'll find that answer
Explanation:
et Array. Get the values that you want to check. It the case of the OP’s question, it would be the four numbers to be checked. We will store these values in an array variable that we call Array. Next we go to step 2.
Set MAX to first number in Array. We need to store the maximum value somewhere, so we create a variable we name MAX to hold this value and we store the first value in Array in MAX. If it is the largest number, great. If not, it will be replaced in the loop. Next we go to step 3.
Set LOOP_INDEX to second Array location. We are going to be checking all the values in Array, so we need to be able to access these values. We also need to know when we have accessed the last value in Array. To be able to both access the values and check for when we are done, we create a variable that we call LOOP_INDEX and store the index value of the second value in the array. For most programming languages, which start at 0 for the first location, this would be 1. For none programmers or those few programming languages that are use 1 for the first location, this value would be 2. We do this because we already have the value from the first Array location. We had stored it in MAX in the previous step. As a result, the first value we will look at in the loop will be the second value in the array. Next we go to step 4.
Set END_LOOP to the last Array location. We need to know when we have reached the end of the array so we create a variable that we can check at the beginning of each pass through the loop. Depending on the actual programming language we are using, finding how many values are in the array could be as simple as checking the length of the array. But this is supported in all languages. We might need to count the number of values when we first store them in the array. For the OP’s question, we are given this value and can hard code (not good programming practice) this value. It would be 3 for 0 based arrays or 4 for 1 based arrays. One final note. Looping through arrays is such a common occurrence that many languages support handling the issue of letting you know when you are at the end. One such command is the “For Each” command. Next we go to step 5.
Is LOOP_INDEX greater than END_LOOP? This is the start of our loop. This is where we check to see if we are finished. We use greater than because because LOOP_INDEX will be equal to END_LOOP in our last pass through the loop and the last thing we do is increment LOOP_INDEX, making it greater than END_LOOP. If LOOP_INDEX is greater than END_LOOP we go to step 9 below. If LOOP_INDEX is not greater than END_LOOP we go to step 6 below.
Is number in Array[LOOP_INDEX] greater than MAX? We are checking to see if the number stored in MAX is greater than the number we are checking in the Array. Here we are at step 6 where we actually check for a maximum number. This is a good example of how much effort goes into programming. There is a lot of “housekeeping” that needs to be done! If MAX is greater, then we go to step 8, otherwise we go to step 7.
Set MAX to value of number in Array[LOOP_INDEX]. We only execute this step if the number in Array{LOOP_INDEX] is larger than the number in MAX. This means that we need to replace MAX with the new value.Next we go to step 8.
Increment LOOP_INDEX. We are at the end of this pass through the loop and need to setup for the next pass. We increment LOOP_INDEX to allow us to check the next value in Array and also to be able to check when we are finished with the loop. From here we go to back to step 5.
MAX contains the largest value in Array. When we get to this step, we have checked every value in Array and the largest value is in MAX. We are finished.
pls Mark me as brainiest and follow me pls