How to print a float number with 2 decimal places in Pascal

1 Answer

0 votes
program PrintFloatDecimalPlaces;
var
  num: Real;
begin
  num := 123.456789;
  
  writeln('Formatted number: ', num:0:2);
end.



(*
run:

Formatted number: 123.46

*)

 



answered Mar 3, 2025 by avibootz

Related questions

2 answers 186 views
3 answers 178 views
3 answers 158 views
2 answers 131 views
2 answers 149 views
3 answers 395 views
...