Skip to content

Commit

Permalink
[alan] Add inputs and results for factors and gcd
Browse files Browse the repository at this point in the history
  • Loading branch information
kostis committed Aug 27, 2024
1 parent 7326250 commit 765a532
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion alan/programs/factors.alan
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ main() : proc
flag : int;

{
writeString("Enter value of N > ");
writeString("Please, give me a positive integer: ");
n = readInteger();
lcv = 2; flag = 1;
while (lcv <= (n / 2))
Expand Down
1 change: 1 addition & 0 deletions alan/programs/factors.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
37483783
3 changes: 3 additions & 0 deletions alan/programs/factors.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Please, give me a positive integer: The non-trivial factors of 37483783 are:
293
127931
10 changes: 5 additions & 5 deletions alan/programs/gcd.alan
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ gcd():proc
b:int;

{
writeString("Give the first integer: ");
a=readInteger();
writeString("Give the second integer: ");
b=readInteger();
writeString("\nThe gcd you are looking for is ");
writeString("Give me two positive integers: \n");
a = readInteger();
b = readInteger();
writeString("\nTheir GCD is: ");
writeInteger(find_gcd(a, b));
writeString("\n");
}
2 changes: 2 additions & 0 deletions alan/programs/gcd.input
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
123456789
666
3 changes: 3 additions & 0 deletions alan/programs/gcd.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Give me two positive integers:

Their GCD is: 9

0 comments on commit 765a532

Please sign in to comment.