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

Tabela d.29. TRUNC - funkcija

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

END.

 

Kraj

Listing programa:

PROGRAM pTRUNC;
USES
  WinCrt;
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);
END.

Index