summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/c-pascal/prog/guess.pas
blob: 743f297622eaba1c3eb50e1eb284f27b73cdf146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.