reynoldswrap530 has asked for the wisdom of the Perl Monks concerning the following question:
1. Start
2. Ask user to input a positive integer (or a negative integer to stop)
3. Record the user's input
4. Test the input >= 0
4a. If true
4a1. Add the input to "running total"
4a2. Increment "number of inputs counter"
4a3. Test if "number of inputs counter" is equal to 1
4a31. If true, replace both "highest input" and "lowest input" with the input
4a5. If the input > "highest input" then replace "highest input" with input
4a6. If the input < "lowest input" then replace "lowest input" with input
4a7. Goto step 2
4b. If false
4b1. Goto step 5
5. Calculate the average (formula: "running total" /"number of inputs counter" )
6. Display/communicate the "highest input", "lowest input" and average
7. Terminate
Thanks for anybody who could convert this to Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help converting!!!
by choroba (Cardinal) on Nov 15, 2015 at 23:07 UTC | |
by tonto (Friar) on Nov 15, 2015 at 23:53 UTC | |
by james28909 (Deacon) on Nov 16, 2015 at 02:18 UTC | |
by LanX (Saint) on Nov 16, 2015 at 02:48 UTC | |
by james28909 (Deacon) on Nov 16, 2015 at 04:32 UTC | |
by Preceptor (Deacon) on Nov 16, 2015 at 17:29 UTC | |
by LanX (Saint) on Nov 16, 2015 at 17:53 UTC | |
by afoken (Chancellor) on Nov 17, 2015 at 05:38 UTC | |
by dsheroh (Monsignor) on Nov 16, 2015 at 08:35 UTC | |
|
Re: Need help converting!!!
by stevieb (Canon) on Nov 16, 2015 at 00:03 UTC | |
|
Re: Need help converting!!!
by BillKSmith (Monsignor) on Nov 16, 2015 at 15:34 UTC | |
|
Re: Need help converting!!!
by james28909 (Deacon) on Nov 16, 2015 at 02:08 UTC | |
|
Re: Need help converting!!!
by Lennotoecom (Pilgrim) on Nov 16, 2015 at 18:57 UTC |