Three digits real number in Pascal

5.8k views Asked by At

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

There are 1 answers

1
AudioBubble On

Use 0:3

var a,b:real;

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

readln;
end.