Skip to content

Commit

Permalink
Some changes to pythagorean triples
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonia Heinen committed Mar 24, 2021
1 parent aaf0635 commit e6fd8f3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions SamplePrograms/PythagoreanTriple.krpt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Output("A pythagorean triple is a triple of integers a, b and c, where a^2 + b^2 = c^2 holds");
Output("Let's find some, shall we? ^^\r\n");

For Var i = 1 While i < 20
Const NumberOfRepetitions = 100;

For Var i = 1 While i < Sqrt(NumberOfRepetitions)
{
For Var j = 1 While j < 20
For Var j = 1 While j < Sqrt(NumberOfRepetitions)
{
FindAndOutputTriple(i, j);
Output("");
Expand All @@ -12,6 +14,11 @@ For Var i = 1 While i < 20

Func FindAndOutputTriple(x As Int, y As Int)
{
If (x == y)
{
Return;
}

Var z = x + y * 1i;
z = z * z;

Expand Down

0 comments on commit e6fd8f3

Please sign in to comment.