Question

Develop an algorithm to arrange a list of 10 integer positive numbers in order from the...

Develop an algorithm to arrange a list of 10 integer positive numbers in order
from the lowest to the highest. It has to be with Flowgorithm.

Homework Answers

Answer #1

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

Note: I have attached the required program in Flowgorithm in picture format as well as .fprg file format. If the image looks blurry or if you need to see it better, please save the attached program.fprg file in your system (make sure the extension is .fprg) and open that file in flowgorithm.

FLOWGORITHM SCREENSHOT

OUTPUT

PROGRAM.fprg FILE

<?xml version="1.0"?>

<flowgorithm fileversion="2.11">

    <attributes>

        <attribute name="name" value=""/>

        <attribute name="authors" value="Enigma"/>

        <attribute name="about" value=""/>

        <attribute name="saved" value="2019-09-04 08:28:08 AM"/>

        <attribute name="created" value="RW5pZ21hO1RJVEFOSVVNOzIwMTktMDktMDQ7MDg6MTE6MjUgQU07MjQ4Mw=="/>

        <attribute name="edited" value="RW5pZ21hO1RJVEFOSVVNOzIwMTktMDktMDQ7MDg6MTU6MTggQU07MTtFbmlnbWE7VElUQU5JVU07MjAxOS0wOS0wNDswODoxMzo1NCBBTTtGb3IuZnByZzs1OTc0"/>

        <attribute name="edited" value="RW5pZ21hO1RJVEFOSVVNOzIwMTktMDktMDQ7MDg6Mjg6MDggQU07MTsyNjAw"/>

    </attributes>

    <function name="Main" type="None" variable="">

        <parameters/>

        <body>

            <declare name="size, i, j, temp" type="Integer" array="False" size=""/>

            <assign variable="size" expression="10"/>

            <declare name="numbers" type="Integer" array="True" size="size"/>

            <comment text="filling the array with some random numbers between 0 and 99"/>

            <for variable="i" start="0" end="size-1" direction="inc" step="1">

                <assign variable="numbers[i]" expression="Random(100)"/>

            </for>

            <comment text="displaying numbers before sorting"/>

            <output expression="&quot;Numbers before sorting&quot;" newline="True"/>

            <for variable="i" start="0" end="size-1" direction="inc" step="1">

                <output expression="&quot; &quot;&amp;numbers[i]" newline="False"/>

            </for>

            <output expression="&quot;&quot;" newline="True"/>

            <comment text="now we can sort the numbers in ascending order, using bubble sort algorithm"/>

            <for variable="i" start="0" end="size-1" direction="inc" step="1">

                <for variable="j" start="0" end="size-2" direction="inc" step="1">

                    <comment text="comparing numbers at indices j and j+1"/>

                    <if expression="numbers[j]&gt;numbers[j+1]">

                        <then>

                            <comment text="swapping elements at indices j and j+1"/>

                            <assign variable="temp" expression="numbers[j]"/>

                            <assign variable="numbers[j]" expression="numbers[j+1]"/>

                            <assign variable="numbers[j+1]" expression="temp"/>

                        </then>

                        <else/>

                    </if>

                </for>

            </for>

            <comment text="now displaying numbers in sorted order"/>

            <output expression="&quot;Numbers arranged from lowest to highest&quot;" newline="True"/>

            <for variable="i" start="0" end="size-1" direction="inc" step="1">

                <output expression="&quot; &quot;&amp;numbers[i]" newline="False"/>

            </for>

        </body>

    </function>

</flowgorithm>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Develop an algorithm to arrange a list of 10 integer positive numbers in order from the...
Develop an algorithm to arrange a list of 10 integer positive numbers in order from the lowest to the highest The user must provide (inputs) A. the 10 integer positive numbers Required Outputs 1. The numbers in order *Using Flowgorithm*
10. Arrange the following compounds in a vertical list from highest boiling point (top) to lowest...
10. Arrange the following compounds in a vertical list from highest boiling point (top) to lowest boiling point (bottom) and explain your answer on the basis of whether the substance is Polar, Nonpolar, Ionic, Metallic or Hydrogen bonding: O2, KF, NH3, Cu, HBr (Please note in this question you are not being asked to list BPs but the compounds in a list from highest to lowest BP on the basis of the type of compound.)
The following code implements this algorithm to sort a list of numbers in ascending order. But...
The following code implements this algorithm to sort a list of numbers in ascending order. But some code is missing as indicated by '?'. def sort_in_place(list_num):     for i in range(?):         for j in range(?):             if ?:                 temp = list_num[j]                 list_num[j] = list_num[i]                 list_num[i] = temp my_list = [23,1,45,20,13,-34] sort_in_place(my_list) print(my_list)
Write the function most_factors(numbers) that returns the integer from the list numbers that has the most...
Write the function most_factors(numbers) that returns the integer from the list numbers that has the most factors (divisors without remainder). For example: >>> most_factors([5,10,16,20,25]) 20 # because 20 has the most factors of any of these numbers # 6 factors, i.e., [1, 2, 4, 5, 10, 20] >>> most_factors([1, 2, 3, 4, 5]) 4 # because 4 has the most factors of any of these numbers # 3 factors, i.e., [1, 2, 4] Hints: For each element in numbers, call...
1. Let n be an odd positive integer. Consider a list of n consecutive integers. Show...
1. Let n be an odd positive integer. Consider a list of n consecutive integers. Show that the average is the middle number (that is the number in the middle of the list when they are arranged in an increasing order). What is the average when n is an even positive integer instead? 2. Let x1,x2,...,xn be a list of numbers, and let ¯ x be the average of the list.Which of the following statements must be true? There might...
a. Find an algorithm for solving the following problem: Given a positive integer n, find the...
a. Find an algorithm for solving the following problem: Given a positive integer n, find the list of positive integers whose product is the largest among all the lists of positive integers whose sum is n. For example, if n is 4, the desired list is 2, 2 because 2 × 2 is larger than 1 × 1 × 1 × 1, 2 × 1 × 1, and 3 × 1. If n is 5, the desired list is 2,...
draw flowchart of: 1-algorithm that asks the user to enter three numbers and computes and prints...
draw flowchart of: 1-algorithm that asks the user to enter three numbers and computes and prints out the largest number. 2- an algorithm that asks the for an integer N from the user. The algorithm should find whether the number is positive, negative, or ZERO. 3-an algorithm that asks the user to enter a positive integer N. You then need to calculate the sum of all values from 1 to N.
PYTHON The following code implements this algorithm to sort a list of numbers in ascending order....
PYTHON The following code implements this algorithm to sort a list of numbers in ascending order. But some code is missing as indicated by '?'. def sort_in_place(list_num): for i in range(?): for j in range(?): if ?: temp = list_num[j] list_num[j] = list_num[i] list_num[i] = temp my_list = [23,1,45,20,13,-34] sort_in_place(my_list) print(my_list) Modify the three lines of code in the program below so that the output is [-34, 1, 13, 20, 23, 45]
4. Arrange these different types of bonding and attraction in order of increasing bond strength from...
4. Arrange these different types of bonding and attraction in order of increasing bond strength from the lowest to the highest, carefully explaining your reasoning. H2S –Hydrogen Sulphide. Fe2O3 – Iron Oxide, or rust as we know it. H30+ - Hydronium ion. CO2 – Carbon Dioxide. CH2O – Formaldehyde. Mg3N3 – Magnesium Nitrate. NaCl - Table salt. AlO – Aluminium Oxide. Br2 – Bromine Gas.
List the following four components in order according to their levels of structural organization, from highest...
List the following four components in order according to their levels of structural organization, from highest to lowest. AND – beside each (in your answer list) state the level of structural organization for each component. Please organize your answer and enter it in the space below. Cartilage Amino Acid Brain Golgi body