Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three digits real number in Pascal

I have code in Free pascal, I have real number 3.285714287142857E+000 from a/b.

program threedigits;
var a,b:real;

begin
a:=23;
b:=7;
writeln(a/b);
end.

How to change the number to three digits after comma (3.286)?


1 Answers

Use 0:3

var a,b:real;

begin
a:=23;
b:=7;
writeln(a/b:0:3);

readln;
end.

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!