-fuzzyping#!/usr/bin/perl use strict; my ($a, $b, $c); my $max = shift || die "Usage: pythag.pl <max len>\n"; for ($a=1; $a<$max; $a++) { for ($b=1; $b<$max; $b++) { for ($c=1; $c<$max; $c++) { if ((($a**2) + ($b**2)) == ($c**2)) { print "$a $b $c is a winner\n"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pythagorean's theorem
by dash2 (Hermit) on Feb 27, 2002 at 14:03 UTC | |
by fuzzyping (Chaplain) on Feb 27, 2002 at 17:16 UTC | |
|
Re: Pythagorean theorem
by I0 (Priest) on Feb 27, 2002 at 21:46 UTC | |
by fuzzyping (Chaplain) on Feb 27, 2002 at 22:41 UTC | |
by I0 (Priest) on Feb 27, 2002 at 23:53 UTC |