Hello, I have been working with python for a while and I have to convert this algorithm into Perl and I have never used Perl so I just started but I need this done asap so any help would be appreciated.
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.