program ex5(input,output);
var a, b, c, d : real;
justification : char;
begin
writeln ('Enter a real number');
readln (a);
writeln ('Enter another real number');
readln (b);
writeln ('Enter another real number');
readln (c);
writeln ('Enter the last real number');
readln (d);
writeln ('Right justified: ');
writeln (a: 8:2);
writeln (b: 8:2);
writeln (c: 8:2);
writeln (d: 8:2);
writeln ('Left justified: ');
writeln (a: 2:2);
writeln (b: 2:2);
writeln (c: 2:2);
writeln (d: 2:2);
writeln ('Decimal Points in line: ');
writeln (a: 8:2);
writeln (b: 8:2);
writeln (c: 8:2);
writeln (d: 8:2);
readln;
end.
We declare 4 real numbers. We read the numbers from the keyboard and then use the format descriptor to output them in three different ways, though right justified and decimal points in line are the same.