gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
new sample for ArraysTesting - multiple in recursion
authorDoni Pracner <quinnuendo@gmail.com>
Sun, 19 Jan 2014 21:37:12 +0000 (22:37 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Sun, 19 Jan 2014 21:37:12 +0000 (22:37 +0100)
samples/ArraysTest.mj [new file with mode: 0644]

diff --git a/samples/ArraysTest.mj b/samples/ArraysTest.mj
new file mode 100644 (file)
index 0000000..e9ae981
--- /dev/null
@@ -0,0 +1,29 @@
+program ArraysTest
+{
+       void rek_arr(int i)
+       int[] a; int loc, loc2; {
+               if (i>1){ 
+                               a = new int[i];
+                               loc = 0;
+                               loc2 = 1;
+                               while (loc<i){
+                                       a[loc] = loc2;
+                                       loc++;
+                                       loc2 = loc2 * i;
+                               }
+                               rek_arr(i-1);
+                               loc = 0;
+                               while (loc<i){
+                                       print(a[loc],3);
+                                       loc++;
+                               }
+                               print(0,5);
+               }
+       }
+
+       void main() int max;
+       {
+               max = 5;
+               rek_arr(max);
+       }
+}
\ No newline at end of file
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner