7.3.. Napisati program za izračunavanje y na osnvou vrijednosti k:

Listing programa:


PROGRAM p07311018;
USES
  WinCrt;
VAR
  k : 1..7;
  y : Integer;
BEGIN
  Write('Koeficijent (1 3)');
  Readln(k);
  CASE k OF
    1, 4 : y := k + 2;
    2, 6 : y := k - 2 ;
    3, 5, 7 : y := k * 2 ;
  END;
  Writeln('k = ', k, '  y = ', y);
END.

Ispis na ekranu:

Index