aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hood <hood@panix.com>2020-10-18 01:24:58 -0400
committerPhilip Hood <hood@panix.com>2020-10-18 01:24:58 -0400
commit47554b5efbfc0a2798f1f7391c253d1082082518 (patch)
tree42ebd120471c47b1cd4aa4cb843726e43c6a2899
parent8755614dd314abf4185faf81a246c250055630eb (diff)
downloadperlweeklychallenge-club-47554b5efbfc0a2798f1f7391c253d1082082518.tar.gz
perlweeklychallenge-club-47554b5efbfc0a2798f1f7391c253d1082082518.tar.bz2
perlweeklychallenge-club-47554b5efbfc0a2798f1f7391c253d1082082518.zip
submission for solution #82, ch #1 - for ada (gnat -> gnatmake)
-rw-r--r--challenge-082/pkmnx/gnat/ch_1.adb28
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-082/pkmnx/gnat/ch_1.adb b/challenge-082/pkmnx/gnat/ch_1.adb
new file mode 100644
index 0000000000..c086facc68
--- /dev/null
+++ b/challenge-082/pkmnx/gnat/ch_1.adb
@@ -0,0 +1,28 @@
+
+with ada.command_line; use ada.command_line;
+with ada.Text_IO; use ada.Text_IO;
+with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
+
+procedure ch_1 is
+ M : Long_Integer := Long_Integer'Value(argument (1));
+ N : Long_Integer := Long_Integer'Value(argument (2));
+ p : Long_Integer := 0;
+ gcd : Long_Integer := 0;
+ i : Long_Integer := 0;
+begin
+
+ gcd := N;
+
+ while (M /= 0) loop
+ p := gcd;
+ gcd := M;
+ M := p mod M;
+ end loop;
+
+ for i in 1 .. gcd loop
+ if ( ( gcd mod i ) = 0 ) then
+ put( Long_Integer'Image(i) );
+ end if;
+ end loop;
+
+end ch_1;