It variously rounds a number

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Homework in Pascal

Program: Cispar.pas
File exe: Cispar.exe
File ubuntu: Cispar

It variously rounds a number. It writes its whole and decimal part separately.
{ CISPAR.PAS                Copyright (c) TrSek alias Zdeno Sekerak }
{ Vytvorte program ktory nacita realne cislo a vypise nasledovne:   }
{ zaokruhlene cislo, desatinnu cast cisla a celu cast cisla.        }
{                                                                   }
{ Datum:23.05.2004                             http://www.trsek.com }
 
program cislo_parser;
var c:real;
 
begin
  WriteLn('Rozne sposoby zaokruhlovania');
  Write('Zadaj realne cislo c=');
  ReadLn(c);
 
  WriteLn('Zaokruhlene cislo je   :', round(c));
  WriteLn('Desatinna cast cisla je:', (c - trunc(c)):0:8);
  WriteLn('Cela cast cisla je     :', trunc(c));
  ReadLn;
end.