diff options
| author | Adam Russell <ac.russell@live.com> | 2019-06-09 00:19:26 -0400 |
|---|---|---|
| committer | Adam Russell <ac.russell@live.com> | 2019-06-09 00:19:26 -0400 |
| commit | f70444df60782c54955c25d7b462b002a16fa498 (patch) | |
| tree | 445f1bf43b33d75082e9411b58609a094477f372 | |
| parent | 82d3bc4156c6bc9a94bb5d6bca89b7b747371cc6 (diff) | |
| download | perlweeklychallenge-club-f70444df60782c54955c25d7b462b002a16fa498.tar.gz perlweeklychallenge-club-f70444df60782c54955c25d7b462b002a16fa498.tar.bz2 perlweeklychallenge-club-f70444df60782c54955c25d7b462b002a16fa498.zip | |
solution for challenge 011
| -rw-r--r-- | challenge-011/adam-russell/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-011/adam-russell/perl5/ch-1.pl | 14 | ||||
| -rw-r--r-- | challenge-011/adam-russell/perl5/ch-2.pl | 18 |
3 files changed, 33 insertions, 0 deletions
diff --git a/challenge-011/adam-russell/blog.txt b/challenge-011/adam-russell/blog.txt new file mode 100644 index 0000000000..1b39aba56b --- /dev/null +++ b/challenge-011/adam-russell/blog.txt @@ -0,0 +1 @@ +https://adamcrussell.livejournal.com/3900.html diff --git a/challenge-011/adam-russell/perl5/ch-1.pl b/challenge-011/adam-russell/perl5/ch-1.pl new file mode 100644 index 0000000000..a723c744a4 --- /dev/null +++ b/challenge-011/adam-russell/perl5/ch-1.pl @@ -0,0 +1,14 @@ +use strict; +use warnings; +## +# Write a script that computes the equal point in the Fahrenheit and Celsius +# scales, knowing that the freezing point of water is 32 °F and 0 °C, and +# that the boiling point of water is 212 °F and 100 °C. +# °F = (°C * 9/5) + 32 +## +for my $c (-100 .. 100){ + my $f = ($c * (9/5)) + 32; + if($f == $c){ + print "°F = °C at $f\n"; + } +} diff --git a/challenge-011/adam-russell/perl5/ch-2.pl b/challenge-011/adam-russell/perl5/ch-2.pl new file mode 100644 index 0000000000..d29c2bf377 --- /dev/null +++ b/challenge-011/adam-russell/perl5/ch-2.pl @@ -0,0 +1,18 @@ +use strict; +use warnings; +## +# Write a script to create an Identity Matrix for the given size. +# For example, if the size is 4, then create Identity Matrix 4x4. +## +use constant SIZE => 10; + +my @a; +for my $i (0 .. SIZE - 1){ + my @b = (0) x SIZE; + $b[$i] = 1; + push @a, \@b; +} +print SIZE . " x " . SIZE . " identity matrix:\n"; +for my $i (0 .. SIZE - 1){ + print "\t" . join(" ", @{$a[$i]}) . "\n"; +} |
