gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mj samples reformated to be consistent
authorDoni Pracner <quinnuendo@gmail.com>
Sun, 30 Aug 2015 14:15:42 +0000 (16:15 +0200)
committerDoni Pracner <quinnuendo@gmail.com>
Sun, 30 Aug 2015 14:15:42 +0000 (16:15 +0200)
samples/RekFac.mj
samples/RekFib.mj
samples/div0.mj
samples/div2.mj
samples/eratos.mj
samples/pos-neg.mj

index 40817fd9b0f0e560c88f7cf03c9fa1fa2a2706d0..674cc14804aef54c9cc215dbf1c6c1a44b80467c 100644 (file)
@@ -2,8 +2,10 @@ program RekFac{
 
        int factorial(int f)
        {
-               if (f<0) return 0;
-               if (f<=1) return 1;
+               if (f<0) 
+                       return 0;
+               if (f<=1) 
+                       return 1;
                return factorial(f-1) * f ;
        }
        
index f4e3f097f67e54256633e288bac8d2a2000a9d32..d3a59a50b519ae85b39f7841797d48a3e9332a7a 100644 (file)
@@ -2,8 +2,10 @@ program RekFib{
 
        int fib(int f)
        {
-               if (f==0) return 0;
-               if (f==1) return 1;
+               if (f==0) 
+                       return 0;
+               if (f==1) 
+                       return 1;
                return fib(f-2)+fib(f-1) ;
        }
        
index d8fb689209baecc0cc8a5c4fd6a3ec21844be92f..bd92135e94028ee0ebc99fbeafc58f1a40e432a9 100644 (file)
@@ -3,7 +3,8 @@ program test
        void main()\r
                int i, j;\r
        {\r
-               i = 100; j = 0;\r
+               i = 100; \r
+               j = 0;\r
                print(i/j);\r
        }\r
 \r
index d498e3d1835931b65a23200ed9bd7b4a4c9bb4e3..455b4af4afbaf80b0eaec91300d585f2c050c526 100644 (file)
@@ -3,7 +3,8 @@ program test
        void main()\r
                int i, j;\r
        {\r
-               i = 100; j = 2;\r
+               i = 100; \r
+               j = 2;\r
                print(i/j);\r
        }\r
 \r
index 620bd2daa1af7fe783cd2fd6adbd5a075b94239d..92d28f88b65b66fbbc814aecfde16e997cf7fc1e 100644 (file)
@@ -7,7 +7,11 @@ program Eratos
 {\r
        void put(int x)\r
        {\r
-               if (npp == 10) {print(chr(13)); print(chr(10)); npp = 0;}\r
+               if (npp == 10) {\r
+                       print(chr(13)); \r
+                       print(chr(10)); \r
+                       npp = 0;\r
+               }\r
                print(x, 5);\r
                npp++;\r
        }\r
@@ -17,7 +21,9 @@ program Eratos
        {\r
                put(x);\r
                i = x;\r
-               while (i <= max) {sieve[i] = 'o'; i = i + x;}\r
+               while (i <= max) {\r
+                       sieve[i] = 'o'; i = i + x;\r
+               }\r
        }\r
 \r
        void main()\r
@@ -27,11 +33,14 @@ program Eratos
                npp = 0;\r
                sieve = new char[max+1];\r
                i = 0;\r
-               while (i <= max) {sieve[i] = 'x'; i++;}\r
+               while (i <= max) {\r
+                       sieve[i] = 'x'; i++;\r
+               }\r
                i = 2;\r
                while (i <= max) {\r
                        found(i);\r
-                       while(i <= max && sieve[i] == 'o') i++;\r
+                       while(i <= max && sieve[i] == 'o') \r
+                               i++;\r
                }\r
        }\r
 \r
index 5bf3771e1f2e7366da4270cff4f65a7f044ea199..79fd45477cdf06766f76b6f4ec2a60ec3b803f09 100644 (file)
@@ -10,10 +10,12 @@ program P
                int x, i;
        { //---------- Initialize val
                val = new Table;
-               val.pos = new int[size]; val.neg = new int[size];
+               val.pos = new int[size]; 
+               val.neg = new int[size];
                i = 0;
                while (i < size) {
-                       val.pos[i] = 0; val.neg[i] = 0;
+                       val.pos[i] = 0; 
+                       val.neg[i] = 0;
                        i++;
                }
        //---------- Read values
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner