Chapter 3 : Formatted Output


QUICK REFERENCE
Format Descriptor for WRITELN or WRITE
or
:<w>
:<w>:<d>
where
<w> is the field width;
<d> is no. of decimal places
Example Statement:
Example Output:
writeln('Take pi =', 3.14159:5:2);
Take pi = 3.14

Example Statement:
Example Output:

writeln('Take pi =', 3.14:10:5);
Take pi =   3.14000

Example Statement:
Example Output:
writeln('My lucky number is', 7:4, '.');
My lucky number is   7.

 


EXERCISE

 Exercise
Description
Open
Download
Exercise 3-1
Bill
click here
ex3-1.pas
Exercise 3-2
Multiplication
click here
ex3-2.pas