Special pythagorean triplet: Difference between revisions
→{{header|ALGOL 68}}: Some optimisations
(timing) |
(→{{header|ALGOL 68}}: Some optimisations) |
||
Line 9:
{{trans|Wren}}
...but doesn't stop on the first solution (thus verifying there is only one).
<lang algol68># find the Pythagorian triplet a, b, c where a + b + c = 1000, a < b < c #
FOR a TO 1000 OVER 3 DO
INT a2 = a * a;
FOR b FROM a + 1 TO 1000 WHILE INT a plus b = a + b;
DO
print( ( "a =
▲ print( ( "a * b * c = ", whole( a * b * c, 0 ), newline ) )
FI
OD
|