summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas')
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas26
1 files changed, 26 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas b/Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas
new file mode 100644
index 00000000000..743f297622e
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas
@@ -0,0 +1,26 @@
+program guess;
+
+var
+ num1, num2: integer;
+
+begin
+ randomize;
+ num2 := random(100);
+
+ repeat
+ { make user guess }
+ write('Guess my number: ');
+ readln(num1);
+
+ { check the relation }
+ if num1 = num2 then
+ writeln('Very well!');
+ if num1 < num2 then
+ writeln('Too small.');
+ if num1 > num2 then
+ writeln('Too big.');
+ until num1 = num2;
+
+ { pause }
+ readln;
+end.