TRUNC - Vraĉa cio dio realnog broja
Sintaksa: FUNCTION TRUNC(vrijednost:<REAL>): <LONGINTEGER>;

Listing programa

Ekran

Opis

PROGRAM Slucajan;

 

Zaglavlje

VAR

 

 

  i: REAL;

 

String

BEGIN

 

 

WRITELN('REAL     ZOKRUZEN');

REAL ZOKRUZEN

 

  i := 9.99;

 

 

  WRITELN(i, TRUNC(i):10);

9.99     9

Cio broj

  i := -9.99;

 

 

  WRITELN(i, TRUNC(i):10);

-9.99   -9

Cio broj

  i := 0.99;

 

 

  WRITELN(i, TRUNC(i):10);

0.99     0

Cio broj

  i := -0.99;

 

 

  WRITELN(i, TRUNC(i):10);

-0.99    0

Cio broj

  i := 9.49;

 

 

  WRITELN(i, TRUNC(i):10);

9.49     9

Cio broj

  i := -9.49;

 

 

  WRITELN(i, TRUNC(i):10);

-9.49   -9

Cio broj

  i := 0.49;

 

 

  WRITELN(i, TRUNC(i):10);

0.49     0

Cio broj

  i := -0.49;

 

 

  WRITELN(i, TRUNC(i):10);

-0.49    0

Cio broj

READLN; END.

 

Kraj

Listing programa:


PROGRAM pTRUNC;
VAR
  i: REAL;
BEGIN
WRITELN('REAL     ZOKRUZEN');
  i := 9.99;
  WRITELN(i, TRUNC(i):10);
  i := -9.99;
  WRITELN(i, TRUNC(i):10);
  i := 0.99;
  WRITELN(i, TRUNC(i):10);
  i := -0.99;
  WRITELN(i, TRUNC(i):10);
  i := 9.49;
  WRITELN(i, TRUNC(i):10);
  i := -9.49;
  WRITELN(i, TRUNC(i):10);
  i := 0.49;
  WRITELN(i, TRUNC(i):10);
  i := -0.49;
  WRITELN(i, TRUNC(i):10);
  READLN;
END.

Index