Commits

Anonymous committed 799a5c8

Diff the results of these two to see how much modulo can differ.

Comments (0)

Files changed (2)

+
+for i = -5,5,1 do
+  for j = -5,5,1 do
+    line = string.format("%2d mod %2d = ", i, j)
+    if j == 0 then
+      line = line .. "undefined"
+    else
+      line = line .. string.format("%d", i % j)
+    end
+    print(line)
+  end
+end

pascal/modulo.pas

+program Hello;
+
+var i: integer;
+var j: integer;
+
+begin
+  for i := -5 to 5 do
+    for j := -5 to 5 do
+      begin
+        if (i >= 0) then write(' ');
+        write(i, ' mod ');
+        if (j >= 0) then write(' ');
+        write(j, ' = ');
+        if (j = 0) then
+          writeln('undefined')
+        else
+          writeln(i mod j)
+      end
+end.