go ahead... be a heretic | |
PerlMonks |
Need help converting!!!by reynoldswrap530 (Initiate) |
on Nov 15, 2015 at 22:54 UTC ( [id://1147761]=perlquestion: print w/replies, xml ) | Need Help?? |
reynoldswrap530 has asked for the wisdom of the Perl Monks concerning the following question:
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.
Back to
Seekers of Perl Wisdom
|
|