Andrew_Levenson has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my ($i, $j, $x, $tot); my @exes; print "Please enter for how many values of x you will be finding the Standard Deviation.\n"; do {chomp($i=<>); print "\nPlease only use numbers.\n" if $i=~m/\D/;} until($i!~m/\D/ and $i=~m/\d/); print "\nPlease input the values of x, one at a time.\n"; for $j(1..$i){ do {chomp($x=<>); print "\nPlease only use numbers.\n" if $x=~m/\D +/;} until($x!~m/\D/ and $x=~m/\d/); push @exes, $x;} undef $x; for(@exes){ $x=$x+$_;} my $ave=$x/$i; for(@exes){ $tot=$tot+(($_-$ave)^2);} my $deviation=sqrt($tot/$i); print "\nThe Standard Deviation of that set of numbers is $deviation.\ +n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Refusal to Run
by jeffa (Bishop) on Aug 02, 2006 at 21:30 UTC | |
by Andrew_Levenson (Hermit) on Aug 03, 2006 at 01:01 UTC | |
|
Re: Refusal to Run
by betterworld (Curate) on Aug 02, 2006 at 20:32 UTC | |
|
Re: Refusal to Run
by gawatkins (Monsignor) on Aug 02, 2006 at 20:50 UTC | |
|
Re: Refusal to Run
by Popcorn Dave (Abbot) on Aug 03, 2006 at 03:55 UTC | |
|
Re: Refusal to Run
by bart (Canon) on Aug 03, 2006 at 11:35 UTC | |
by Andrew_Levenson (Hermit) on Aug 03, 2006 at 15:52 UTC | |
|
Re: Refusal to Run
by runrig (Abbot) on Aug 02, 2006 at 20:24 UTC | |
by chromatic (Archbishop) on Aug 02, 2006 at 20:45 UTC |